Closed
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/usage/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
I've seen when using docker image golangci/golangci-lint:v1.55.2
(like in CI/CD or standalone in docker) on a Go project that has a go.mod
file require go version 1.21.4
an error getting thrown:
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: go.mod requires go >= 1.21.4 (running go 1.21.3; GOTOOLCHAIN=local)\n"
Version of golangci-lint
$ docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint version
golangci-lint has version v1.55.2 built with go1.21.3 from e3c2265f on 2023-11-03T13:27:54Z
Configuration
No custom configuration file is used.
Go environment
$ docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 go version
go version go1.21.3 linux/arm64
$ docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/app/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1679194962=/tmp/go-build -gno-record-gcc-switches'
Verbose output of running
$ docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused]"
level=info msg="[loader] Go packages loading at mode 575 (types_sizes|deps|name|imports|compiled_files|exports_file|files) took 15.058319ms"
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: go.mod requires go >= 1.21.4 (running go 1.21.3; GOTOOLCHAIN=local)\n"
level=info msg="Memory: 2 samples, avg is 22.1MB, max is 22.1MB"
level=info msg="Execution took 18.943095ms"
A minimal reproducible example or link to a public repository
From repo scacner/go-hello-world
package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
Validation
- Yes, I've included all the information above (version, config, etc.).