Skip to content

fix: compatibility with go1.18 #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export PATH=$PATH_BIN:$PATH
# coz other runners in the same host may share path like GOMODCACHE, GOCACHE
export GOBIN=$PATH_BIN

# Fix some dependency versions to ensure compatibility when testing with Go 1.18
# TODO: Remove this if Go 1.18 is no longer supported
if [[ `go version` == *"go1.18"* ]]; then
IS_GO_118=true
else
IS_GO_118=false
fi

PROTOC_VERSION=v3.20.2

install_protoc() {
Expand Down Expand Up @@ -78,14 +86,22 @@ kitex_cmd() {

echo -e "\ninstalling missing commands\n"

PROTOC_GEN_GO_VERSION="latest"
PROTOC_GEN_GO_GRPC_VERSION="latest"
if $IS_GO_118; then
# fix the version when running go1.18
PROTOC_GEN_GO_VERSION="v1.31.0"
PROTOC_GEN_GO_GRPC_VERSION="v1.3.0"
fi

# install protoc
which protoc || install_protoc &

# install protoc-gen-go and protoc-gen-go-kitexgrpc
which protoc-gen-go || go_install google.golang.org/protobuf/cmd/protoc-gen-go@latest &
which protoc-gen-go || go_install "google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}" &

# install protoc-gen-go and protoc-gen-go-kitexgrpc
which protoc-gen-go-grpc || go_install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &
which protoc-gen-go-grpc || go_install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION}" &

# install thriftgo
which thriftgo || go_install github.com/cloudwego/thriftgo@latest &
Expand Down Expand Up @@ -177,6 +193,12 @@ fixed_version google.golang.org/genproto/googleapis/rpc v0.0.0-20250227231956-55
# can we get rid of it one day? used in kitexgrpc/normalcall/normalcall_test.go
fixed_version github.com/shirou/gopsutil/v3 v3.24.5

if $IS_GO_118; then
# fix the version when running go1.18
fixed_version google.golang.org/grpc v1.56.3
fixed_version google.golang.org/protobuf v1.34.1
fi

go mod tidy

echo -e "\nupdating dependencies ... done\n"
Expand Down
2 changes: 1 addition & 1 deletion thrift_streaming/exitserver/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cloudwego/kitex-tests/thrift_streaming/exitserver

go 1.21.13
go 1.18

require (
github.com/cloudwego/gopkg v0.1.4
Expand Down
2 changes: 0 additions & 2 deletions thrift_streaming/exitserver/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
Expand Down Expand Up @@ -93,7 +92,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
Expand Down