-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add an option to set the Go version #1143
Comments
@ldez The new approach is using the I am thinking to keep the current behaviour as default and introduce an environment variable to bypass the go list parsing something like |
Yes because golangci-lint loads the rules for each package, so a
An env var can work. Note: currently, only 2 rules (G601 and G113) use the |
@ccojocar I was expected to be able to set the go version through the env var because the // GoVersion returns parsed version of Go mod version and fallback to runtime version if not found.
func GoVersion() (int, int, int) {
if env, ok := os.LookupEnv("GOSECGOVERSION"); ok {
return parseGoVersion(strings.TrimPrefix(env, "go"))
}
goVersion, err := goModVersion()
if err != nil {
return parseGoVersion(strings.TrimPrefix(runtime.Version(), "go"))
}
return parseGoVersion(goVersion)
} |
Summary
Hello,
I know that my request is really specific to golangci-lint, and if you don't want to do that I will understand.
The new way for gosec to detect the Go version has a huge impact on golangci-lint performances.
The best solution for us is to have an option to set the Go version to bypass the usage of
go list
.Steps to reproduce the behavior
golangci/golangci-lint#4735
gosec version
v2.20.0
Go version (output of 'go version')
Operating system / Environment
Not dependent on the OS
The text was updated successfully, but these errors were encountered: