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

Cannot install golangci-lint from source on Go <= 1.15 #1969

Closed
4 tasks
pellared opened this issue May 11, 2021 · 4 comments
Closed
4 tasks

Cannot install golangci-lint from source on Go <= 1.15 #1969

pellared opened this issue May 11, 2021 · 4 comments
Labels
question Further information is requested

Comments

@pellared
Copy link

pellared commented May 11, 2021

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)
Description of the problem

golangci-lint started to "indirectly" depend on a Go standard library https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/buildtag package which is available only starting from Go 1.16

Example failure on Go 1.14:

github.com/golangci/golangci-lint/cmd/golangci-lint imports
github.com/golangci/golangci-lint/pkg/commands imports
github.com/golangci/golangci-lint/pkg/lint/lintersdb imports
github.com/golangci/golangci-lint/pkg/golinters imports
golang.org/x/tools/go/analysis/passes/buildtag imports
go/build/constraint: package go/build/constraint is not in GOROOT (/opt/hostedtoolcache/go/1.14.15/x64/src/go/build/constraint)

Moreover, the information here is no longer true: https://golangci-lint.run/usage/install/#install-from-source

This is especially not good for repositories using the https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module approach for installing additional Go-based tooling.

I think it would be good to support the 3 latest minor versions of Go. Or at least please fix the docs.

Version of golangci-lint

v1.40.0

Go environment

Any Go < 1.16

@pellared pellared added the bug Something isn't working label May 11, 2021
@ldez ldez added question Further information is requested and removed bug Something isn't working labels May 11, 2021
@ldez
Copy link
Member

ldez commented May 11, 2021

Hello,

We changed our Go version policy, we now support only go1.15 and go1.16 like the Go team.

You can use the binary with go1.14

#1926

@ldez ldez closed this as completed May 11, 2021
@pellared
Copy link
Author

@ldez I think you should update the docs: https://golangci-lint.run/usage/install/#install-from-source 😉

@bombsimon
Copy link
Member

@ldez I think you should update the docs: https://golangci-lint.run/usage/install/#install-from-source 😉

I fail to see what's wrong with the docs?

Install from Source

Note: such go get installation aren't guaranteed to work. We recommend using binary installation.

Why?

go get installation isn't recommended because of the following points:

  1. some users use -u flag for go get, which upgrades our dependencies. Resulting configuration wasn't tested and isn't guaranteed to work.
  2. go.mod replacement directive doesn't apply. It means a user will be using patched version of golangci-lint if we use such replacements.
  3. it's stability depends on a user's Go version (e.g. on this compiler Go <= 1.12 bug).
  4. we've encountered a lot of issues with Go modules hashes.
  5. it allows installation from master branch which can't be considered stable.
  6. it's slower than binary installation

All of this holds true, it recommend you to not install with go get and nothing mentions a specific Go version.

@pellared
Copy link
Author

@idez @bombsimon Thanks to both of your for your patience and answers 👍 I have also put a proposal here: #1657 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants