Skip to content

Commit 5f0f79e

Browse files
authored
Merge pull request #626 from cloudwego/hotfix/revert_go_16_api
hotfix: revert golang 1.16 api for compatibility with lower go version
2 parents 995948d + 4eefa87 commit 5f0f79e

35 files changed

Lines changed: 317 additions & 207 deletions

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
unit-benchmark-test:
77
strategy:
88
matrix:
9-
go: [ 1.17, 1.18, 1.19 ]
9+
go: [ 1.15, 1.17, 1.18, 1.19 ]
1010
os: [ X64, ARM64 ]
1111
runs-on: ${{ matrix.os }}
1212
steps:
@@ -34,7 +34,7 @@ jobs:
3434
scenario-test:
3535
strategy:
3636
matrix:
37-
go: [ 1.17, 1.18 ]
37+
go: [ 1.15, 1.18 ]
3838
runs-on: [ self-hosted, X64 ]
3939
steps:
4040
- uses: actions/checkout@v3

.licenserc.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ header:
44
copyright-owner: CloudWeGo Authors
55

66
paths:
7-
- '**/*.go'
8-
- '**/*.s'
7+
- "**/*.go"
8+
- "**/*.s"
99

1010
paths-ignore:
1111
- internal/mocks/thrift/test.go
12+
- pkg/remote/codec/thrift/thrift_frugal.go
13+
- pkg/remote/codec/thrift/thrift_frugal_test.go
14+
- pkg/remote/codec/thrift/thrift_others.go
1215
- pkg/remote/trans/nphttp2/codes/codes.go
1316
- pkg/remote/trans/nphttp2/grpc/grpcframe/
1417
- pkg/remote/trans/nphttp2/grpc/bdp_estimator.go

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cloudwego/kitex
22

3-
go 1.16
3+
go 1.13
44

55
require (
66
github.com/apache/thrift v0.13.0
@@ -9,7 +9,7 @@ require (
99
github.com/cloudwego/fastpb v0.0.2
1010
github.com/cloudwego/frugal v0.1.3
1111
github.com/cloudwego/netpoll v0.2.6
12-
github.com/cloudwego/thriftgo v0.2.0
12+
github.com/cloudwego/thriftgo v0.2.1
1313
github.com/golang/mock v1.6.0
1414
github.com/jhump/protoreflect v1.8.2
1515
github.com/json-iterator/go v1.1.12

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ github.com/cloudwego/netpoll v0.2.4/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzC
2323
github.com/cloudwego/netpoll v0.2.6 h1:vzN8cyayoa9RdCOG87tqkYO/j2hA4SMLC+vkcNUq6uI=
2424
github.com/cloudwego/netpoll v0.2.6/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E=
2525
github.com/cloudwego/thriftgo v0.1.2/go.mod h1:LzeafuLSiHA9JTiWC8TIMIq64iadeObgRUhmVG1OC/w=
26-
github.com/cloudwego/thriftgo v0.2.0 h1:gDNxU1CmNkwwe/I9UfuCTIc1DXu5FVFa2cMWwT61e50=
27-
github.com/cloudwego/thriftgo v0.2.0/go.mod h1:aZxiVX7KJdonZwwnapZEMDAAGUGk9WCIkNU3YoVjbpg=
26+
github.com/cloudwego/thriftgo v0.2.1 h1:pKEZDDND14+kG4ILPCq0sqv3gidjxOnf/wLjOwxzBks=
27+
github.com/cloudwego/thriftgo v0.2.1/go.mod h1:8i9AF5uDdWHGqzUhXDlubCjx4MEfKvWXGQlMWyR0tM4=
2828
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
2929
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3030
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

pkg/generic/httppbthrift_codec.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24+
"io/ioutil"
2425
"net/http"
2526
"strings"
2627
"sync/atomic"
@@ -168,7 +169,7 @@ func FromHTTPPbRequest(req *http.Request) (*HTTPRequest, error) {
168169
// body == nil if from Get request
169170
return customReq, nil
170171
}
171-
if customReq.RawBody, err = io.ReadAll(b); err != nil {
172+
if customReq.RawBody, err = ioutil.ReadAll(b); err != nil {
172173
return nil, err
173174
}
174175
if len(customReq.RawBody) == 0 {

pkg/generic/httpthrift_codec.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24+
"io/ioutil"
2425
"net/http"
2526
"sync/atomic"
2627

@@ -154,7 +155,7 @@ func FromHTTPRequest(req *http.Request) (*HTTPRequest, error) {
154155
// body == nil if from Get request
155156
return customReq, nil
156157
}
157-
if customReq.RawBody, err = io.ReadAll(b); err != nil {
158+
if customReq.RawBody, err = ioutil.ReadAll(b); err != nil {
158159
return nil, err
159160
}
160161
if len(customReq.RawBody) == 0 {

pkg/remote/codec/thrift/thrift.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func (c thriftCodec) Unmarshal(ctx context.Context, message remote.Message, in r
172172
data := message.Data()
173173

174174
// decode with hyper unmarshal
175-
if c.hyperMarshalEnabled() && hyperMessageUnmarshalAvailable(data, message) {
175+
if c.hyperMessageUnmarshalEnabled() && hyperMessageUnmarshalAvailable(data, message) {
176176
msgBeginLen := bthrift.Binary.MessageBeginLength(methodName, msgType, seqID)
177177
ri := message.RPCInfo()
178178
internal_stats.Record(ctx, ri, stats.WaitReadStart, nil)

pkg/remote/codec/thrift/thrift_frugal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build amd64 && !windows
2-
// +build amd64,!windows
1+
//go:build amd64 && !windows && !go1.13 && !go.14
2+
// +build amd64,!windows,!go1.13,!go.14
33

44
/*
55
* Copyright 2021 CloudWeGo Authors

pkg/remote/codec/thrift/thrift_frugal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build amd64 && !windows
2-
// +build amd64,!windows
1+
//go:build amd64 && !windows && !go1.13 && !go.14
2+
// +build amd64,!windows,!go1.13,!go.14
33

44
// Copyright 2022 ByteDance Inc.
55
//

pkg/remote/codec/thrift/thrift_others.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !amd64 || windows
2-
// +build !amd64 windows
1+
//go:build !amd64 || windows || go1.13 || go1.14
2+
// +build !amd64 windows go1.13 go1.14
33

44
/*
55
* Copyright 2021 CloudWeGo Authors

0 commit comments

Comments
 (0)