-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Welcome
- 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 read the typecheck section of the FAQ (https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors).
- Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
When detecting the current go version, golangci-lint is using gomoddirective, which does only support go.mod files.
Now that the last supported version of Go is 1.20, I would propose to run go version instead to report correctly the version (including toolchain and environment variable support) to ensure we are less reliant on implementation details.
I’m happy to work on this if the approach seems sound to you.
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.58.1 built with go1.22.3 from (unknown, modified: ?, mod sum: "h1:IYKjkt7nofq/mYXiDUyJiBZQi5kxD0jPCjBy6VXxjz8=") on (unknown)Configuration
not related to a particular configuration
Go environment
$ go version && go env
go version go1.22.3 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/didrocks/.cache/go-build'
GOENV='/home/didrocks/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/didrocks/.go/pkg/mod'
GONOPROXY='github.com/canonical/ubuntu-pro-for-wsl'
GONOSUMDB='github.com/canonical/ubuntu-pro-for-wsl'
GOOS='linux'
GOPATH='/home/didrocks/.go'
GOPRIVATE='github.com/canonical/ubuntu-pro-for-wsl'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/didrocks/.go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/didrocks/.go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK='/home/didrocks/work/ubuntu-pro-for-wsl/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1219058700=/tmp/go-build -gno-record-gcc-switches'Verbose output of running
Not related to a given run
A minimal reproducible example or link to a public repository
Example of a project with go.work and multiple subprojects with go.mod: https://github.com/canonical/ubuntu-pro-for-wsl
Validation
- Yes, I've included all information above (version, config, etc.).