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

staticcheck installation fails with go1.16 or older #2162

Closed
hyangah opened this issue Apr 4, 2022 · 6 comments
Closed

staticcheck installation fails with go1.16 or older #2162

hyangah opened this issue Apr 4, 2022 · 6 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented Apr 4, 2022

Staticcheck supports only the last two versions of go.
This broke our builders (go1.15, go1.16), and will confuse users who use go1.16 or older.

go install honnef.co/go/tools/cmd/staticcheck@latest
failed to install tools: installing honnef.co/go/tools/cmd/staticcheck@latest: go: downloading honnef.co/go/tools v0.3.0
go: downloading golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a
go: downloading golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b2019[36](https://github.com/golang/vscode-go/runs/5817503085?check_suite_focus=true#step:7:36)e
go: downloading github.com/BurntSushi/toml v0.4.1
Error: ../../../go/pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment
@gopherbot gopherbot added this to the Untriaged milestone Apr 4, 2022
@suzmue suzmue modified the milestones: Untriaged, v0.33.0 Apr 4, 2022
@hyangah
Copy link
Contributor Author

hyangah commented Apr 5, 2022

Options I am thinking:

  • annotate each tool with their min go version requirements, and if go is too old, ask users to use newer Go or configure go.toolsManagement.go setting
  • carry a version compatibility matrix for each tool, and pick the last, compatible version - this matrix will keep growing, and at a certain point, extension itself won't work with older versions of tools.

@ykfq
Copy link

ykfq commented Apr 9, 2022

Same issue when installing staticcheck in vscode 1.66.1 with go1.16.15, or just installing from command line:

go install -v honnef.co/go/tools/cmd/staticcheck@latest
go/pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment

@elulcao
Copy link

elulcao commented Apr 12, 2022

Same issue when installing staticcheck in vscode 1.66.1 with go1.16.15, or just installing from command line:

go install -v honnef.co/go/tools/cmd/staticcheck@latest
go/pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment

I created dominikh/go-tools#1251, seems to be the same like this error.

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/400363 mentions this issue: src/goTools: install staticcheck@v0.2.2 when using go1.16 or older

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/400362 mentions this issue: tools/installtools: install staticcheck@v0.2.2 for go < 1.17

@hyangah
Copy link
Contributor Author

hyangah commented Apr 19, 2022

I hoped to encourage users to utilize go.toolsManagement.go and use newer versions of go for tool installations. But, I also noticed major cloud service providers still are stuck in go1.16, so I think we need more careful planning if we want to take that route. For now, in cl/400362, I am making the install picks up v0.2.2 (another special case handling).

gopherbot pushed a commit that referenced this issue Apr 20, 2022
Updates #2162

Change-Id: I5adc4ca6d7b0f8a8e3df7e1f403917fc94ef7b23
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/400362
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@golang golang locked and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants