Skip to content
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

all: require go 1.21+ for tools installation #3411

Closed
hyangah opened this issue May 28, 2024 · 6 comments
Closed

all: require go 1.21+ for tools installation #3411

hyangah opened this issue May 28, 2024 · 6 comments
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented May 28, 2024

The upcoming gopls requires go1.21+ for installation.
golang/go#65917

Update the min version in the README and tools installation logic.

@hyangah hyangah added this to the v0.42.0 milestone May 28, 2024
@gopherbot gopherbot modified the milestones: v0.42.0, Untriaged May 28, 2024
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/588757 mentions this issue: extension/src: require go1.19+ for tools installation

gopherbot pushed a commit that referenced this issue May 29, 2024
Gopls v0.15.x requires go 1.19 or newer.
Update the README and the installation error message
to clarify the extension requires go 1.19+.

Gopls v0.16+ will require go 1.21+.
The next staticcheck will require go 1.22+. If go1.21
is used, `go install` will be able to pick up go 1.22,
so effectively, the extension does not have to worry
about tool's go version requirement any more if the
go version used for tools installation is go 1.21+.

Encode these version mapping metrix in goTools.ts and
installtools script.

Run go run tools/generate.go -tools
 that updates gopls latest version.

Fixes #3409
For #3411

Change-Id: Ib8177cda8c79a7251cb11f26ea3def18630f3858
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/588757
Commit-Queue: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
kokoro-CI: kokoro <[email protected]>
@findleyr findleyr modified the milestones: Untriaged, v0.42.0 Jun 6, 2024
@findleyr
Copy link
Member

findleyr commented Jun 6, 2024

Putting this in the v0.42.0 milestone. @hyangah please remilestone if that is incorrect.

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/616675 mentions this issue: README.md: clarify supported go & tools versions

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/616676 mentions this issue: extension/src/goInstallTools.ts: require go1.21+ for tools installation

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/616677 mentions this issue: extension: update go to go1.23.1

gopherbot pushed a commit that referenced this issue Sep 30, 2024
Based on the clarified version support policy:

- Add github.com/golang/vscode-go/wiki/compatibility
to have the version compatibility matrix.

- Drop go1.20 from GH action workflows.

- Let extension/tools/installtools require go1.21+.

For #3411
For #3412

Change-Id: I10ffafa3234e691e9e27f84385aa68efa7db733f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/616675
kokoro-CI: kokoro <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Commit-Queue: Hyang-Ah Hana Kim <[email protected]>
hyangah added a commit to hyangah/vscode-go that referenced this issue Oct 10, 2024
The Go extension will require go1.21 for tools installation from v0.44.0
(and is prerelease version v0.43.x).

This is a planned change and it was discussed in the v0.42.0 release note.
(https://github.com/golang/vscode-go/releases/tag/v0.42.0 Jul 17 2024).

`installTools` is the entry function for tools installation.
If the go version is too old, it suggests go1.21+ or the workaround
(go.toolsManagement.go).

* Misc changes
 - Previously, when the build info of a binary is not available,
   we didn't ask to update the tool. Since go1.18, the build info
   should be available. So, now suggest to reinstall the tool.
 - Bug fix: For vscgo, we used toolExecutionEnvironment when running
   go install.
   It should be toolInstallationEnvironment. This clears some env vars
   like GO111MODULE, GOPROXY, GOOS, GOARCH, GOROOT which can interfere
   with the go tool invocation.

Fixes golang#3411

Change-Id: Ifff0661d88a9adfc6bd3e0a25702d91921bcb77f
hyangah added a commit to hyangah/vscode-go that referenced this issue Oct 10, 2024
We want to use the latest go when developing our own
release/testing support tools and scripts.
So, update go.mod to do so.

However, we need to be careful when using
the `installtools` script.
The purpose of `installtools` is to install tools
needed by integration tests. It selected the latest
version of each tool compatible with the default
go version in the system. For example, in the CI is
setup with go1.22, we want to install tools that
officially claim they support go1.22.

`installtools` detects the go version using
the `go` command. As we change our go.mod to use
go1.23.1 as the go directive, the `go` command running
under our project's repo directory (with GOTOOLCHAIN=auto)
will always be go1.23.1 or newer. That makes go1.22 CI
meaningless.

So, pass `GOTOOLCHAIN=local` when `installtools` computes
the go version using `go list`.

Previously we used `go run` to build/invoke this tool.
But it turned out `go run`/`go generate` modify
(or will modify) `GOROOT` and/or `PATH` when toolchain
switch occurs, which will prevent `installtools`
from detecting the system default toolchain version
even with `GOTOOLCHAIN=local`, or cause the
build fail due to mismatching GOROOT and go toolchain
picked up from PATH.

Therefore, in this CL, we build the binary (it's ok to
build the binary with go1.23.1+), and then run
the installed binary ourselves so the execution of
the binary doesn't get inherit the modified GOROOT/PATH.

For golang#3411

Change-Id: I3e116cf48fb431196359ec42049e70c0b75814ef
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/619715 mentions this issue: extension/test/runTest.ts: set GOTOOLCHAIN=local

gopherbot pushed a commit that referenced this issue Oct 11, 2024
This script runs in CI with the go version under testing.
Prevent the go toolchain switch from getting influenced by
extension/go.mod's choice of go version.

Add a go.mod file with go1.12 to extension/test/testdata/envTest
to make this not part of the extension module. That prevents
go toolchain switch to go1.23 to meet the extension module's
requirement during test (which will fail due to GOTOOLCHAIN=local)
after we update extension/go.mod to require go1.23.1+ in
CL 616677.

Adjust goExplorer.test.ts env tree items test that assumed
GOTOOLCHAIN is empty. Now the test runs with GOTOOLCHAIN=local.

Update .vscode/launch.json to pass GOTOOLCHAIN=local for
integration testing.

For #3411

Change-Id: I02f1cd6512a0030a729668221b163f6cc3e26b0f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/619715
Reviewed-by: Robert Findley <[email protected]>
kokoro-CI: kokoro <[email protected]>
Commit-Queue: Hyang-Ah Hana Kim <[email protected]>
gopherbot pushed a commit that referenced this issue Oct 16, 2024
We want to use the latest go when developing our own
release/testing support tools and scripts.
So, let's update go.mod to do so.

After go1.21, we shouldn't use `go run` to run
the extension/tools/installtools script.
The purpose of `installtools` is to install tools
needed by integration tests and are compatible with
the go version in the system. We arranged the CI
systems to test with the go versions we support.
If we use `go run` from our project, the toolchain
switch will occur and may change `GOROOT`/`PATH`
to enforce the compiled script to use the upgraded
toolchain. That makes the CI setup useless.

Therefore, in this CL, we build the binary (it's ok to
build the binary with go1.23.1+), and then run
the installed binary ourselves so the execution of
the binary doesn't get affected by the modified
GOROOT/PATH.

Kokoro CI also uses the installtools script when
building the docker container. (build/Dockerfile)
There, the script source code is copied over to a
scratch space and run with `go run <go file>`
outside the vscode-go project repo. So, there is
no go toolchain version switch involved already.

And currently we test only with the latest go in
Kokoro, so this toolchain switch issue doesn't apply.

For #3411

Change-Id: I3e116cf48fb431196359ec42049e70c0b75814ef
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/616677
kokoro-CI: kokoro <[email protected]>
Reviewed-by: Hongxiang Jiang <[email protected]>
Commit-Queue: Hyang-Ah Hana Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants