grpc / grpc-go

The Go language implementation of gRPC. HTTP/2 based RPC
https://grpc.io
Apache License 2.0
20.9k stars 4.34k forks source link

"package maps is not in GOROOT" with go1.18 #7646

Open sh1yu opened 3 days ago

sh1yu commented 3 days ago

What version of gRPC are you using?

grpc@v1.66.2

What version of Go are you using (go version)?

1.18

What operating system (Linux, Windows, …) and version?

wsl2

What did you do?

If possible, provide a recipe for reproducing the error. protoc --go_out=. --go-grpc_out=. 111.proto go build abc.go

What did you expect to see?

go build successfully

What did you see instead?

/home/xxx/.go/pkg/mod/google.golang.org/grpc@v1.66.2/experimental/stats/metricregistry.go:22:2: package maps is not in GOROOT (/home/xxx/apps/go1.18/src/maps) /home/xxx/.go/pkg/mod/google.golang.org/grpc@v1.66.2/clientconn.go:27:2: package slices is not in GOROOT (/home/xxx/apps/go1.18/src/slices)

eshitachandwani commented 2 days ago

Thank you for reporting this issue. gRPC now requires Go version 1.22.7 or higher, as specified in here https://github.com/grpc/grpc-go/blob/1418e5ecc61a044aeda9816cfbed7062894acc08/go.mod#L3 Please update your Go installation to resolve this. If the issue persists, please let us know, and we’ll be happy to assist further.

sh1yu commented 2 days ago

It would be helpful if there was a place that could introduce the minimum supported Go versions for each version of gRPC since it's not very convenient to upgrade Go version for some older programs.

eshitachandwani commented 1 day ago

The minimum go version for each version of gRPC is mentioned in the go.mod file for each version. For gRPC@v1.66.2, the minimum supported version is go 1.21 mentioned here: https://github.com/grpc/grpc-go/blob/a75eb1eeeaa9b665a0bca025b61025b2d9d13813/go.mod#L3