Beginning with Go 1.21, go mod tidy updates go.mod with Go version in x.y.z format. Our CI builds currently tests with Go 1.20 as the earliest version, which expects x.y format.
This mismatch creates a conflict because our lint/vet action currently uses 1.21 (and thus fail after after detecting a change after running go mod tidy if using the x.y format) or else fail in the Kokoro build on Go 1.20 if using the x.y.z format.
This original version of this PR attempted to remove the mismatch by (temporarily) downgrading the version of go used for linting, but this caused go vet to fail. The latest version of this PR simply cherry picks the last commit that caused this to break with the last working version of main rebased on HEAD (instead of the default merge that GitHub did to bring HEAD up to date), with go mod tidy run manually.
Here's what works for now
To update a sample to Go 1.21, run go get go@1.21 in the package directory
Run go get toolchain@none (or just delete the line as part of the next step)
Manually edit go.mod to change go 1.21.XX to ONLY go 1.21 -- this is required so that the CI build for the current earliest version (1.20) doesn't fail (x.y.z format won't work for 1.20). This issue will go away when we upgrade the earliest version to 1.21.
Beginning with Go 1.21,
go mod tidy
updatesgo.mod
with Go version inx.y.z
format. Our CI builds currently tests with Go 1.20 as the earliest version, which expectsx.y
format.This mismatch creates a conflict because our lint/vet action currently uses 1.21 (and thus fail after after detecting a change after running
go mod tidy
if using thex.y
format) or else fail in the Kokoro build on Go 1.20 if using thex.y.z
format.This original version of this PR attempted to remove the mismatch by (temporarily) downgrading the version of go used for linting, but this caused go vet to fail. The latest version of this PR simply cherry picks the last commit that caused this to break with the last working version of main rebased on HEAD (instead of the default merge that GitHub did to bring HEAD up to date), with go mod tidy run manually.
Here's what works for now
go get go@1.21
in the package directorygo get toolchain@none
(or just delete the line as part of the next step)go.mod
to changego 1.21.XX
to ONLYgo 1.21
-- this is required so that the CI build for the current earliest version (1.20
) doesn't fail (x.y.z
format won't work for1.20
). This issue will go away when we upgrade the earliest version to1.21
.