You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The go directive in gopls's go.mod is set to 1.23.1 per #65917.
The assumption is that gopls built with go1.23.1+ can be still used to
analyze codebase with slightly older go versions. (e.g. go1.22.x, go1.21.x)
Gopls integration tests run on workspaces created in temp directories
outside golang.org/x/tools/gopls module and their go.mod files have go
version old enough to prevent toolchain switch. With this setup, I hoped
running gopls tests on go1.X builders (X < 23) is sufficient to test our assumption.
But it looks like this is not true.
CL 404134 prepends GOROOT/bin to PATH in go test, as
mentioned in #68005.
In CL 616055 I attempted to verify the go version.
$ GOTOOLCHAIN=local go version
go version go1.22.6 darwin/amd64
$ go version
go version go1.23.1 darwin/amd64
$ go test ./internal/test/integration/workspace -run TestCheckGoVersion
--- FAIL: TestCheckGoVersion (0.02s)
workspace_test.go:1287: /Users/hakim/sdk/go1.23.1/bin/go <nil>
workspace_test.go:1288: go version in PATH = 23
...
$ go test ./internal/test/integration/workspace -run TestViewGoVersion
...
--- FAIL: TestViewGoVersion (0.28s)
--- FAIL: TestViewGoVersion/default (0.28s)
workspace_test.go:1320: SummarizeViews() mismatch (-want +got):
[]command.View{
{
... // 1 ignored and 2 identical fields
Folder: "file:///var/folders/5p/zn7ykc111kn3lm09h_47mz2w001py5/T/gopls-te"...,
EnvOverlay: nil,
- GoVersion: "",
+ GoVersion: "go1.23.1",
},
}
...
I don't know how we can recover the original PATH inside tests reliably.
go test also sets GOROOT environment variable, too, but we can unset it.
@golang/tools-team
The text was updated successfully, but these errors were encountered:
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
Sep 26, 2024
As described in golang/go#69630, our 1.21 and 1.22 builders were not
actually testing gopls' integration with the Go command, because go test
modifies PATH and GOROOT when performing a toolchain switch.
"Fix" this by searching PATH for a local (=non-toolchain) go command,
and then mutating PATH and unsetting GOROOT to use this go command. This
is very much a hack, as noted in the relevant commentary, but allows us
to have much needed test coverage on the builders. In golang/go#69321,
we hope to design a better solution to this problem.
Many tests are updated to make their go version requirements accurate.
Fixesgolang/go#69630
Change-Id: I431107b97845e1e99799c2c22f33b04f85ce6dd9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/623175
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Robert Findley <[email protected]>
The go directive in gopls's go.mod is set to
1.23.1
per #65917.The assumption is that gopls built with go1.23.1+ can be still used to
analyze codebase with slightly older go versions. (e.g. go1.22.x, go1.21.x)
Gopls integration tests run on workspaces created in temp directories
outside golang.org/x/tools/gopls module and their go.mod files have go
version old enough to prevent toolchain switch. With this setup, I hoped
running gopls tests on go1.X builders (X < 23) is sufficient to test our assumption.
But it looks like this is not true.
CL 404134 prepends
GOROOT/bin
toPATH
ingo test
, asmentioned in #68005.
In CL 616055 I attempted to verify the go version.
I don't know how we can recover the original
PATH
inside tests reliably.go test
also setsGOROOT
environment variable, too, but we can unset it.@golang/tools-team
The text was updated successfully, but these errors were encountered: