Closed
Description
Thank you for creating the issue!
- 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).
Please include the following information:
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.32.2 built from (unknown, mod sum: "h1:CgIeFWTLJ3Nt1w/WU1RO351j/CjN6LIVjppbJfI9nMk=") on (unknown)
Config file
$ cat .golangci.yml
run:
modules-download-mode: readonly
skip-dirs:
- .git
- .github
- .vscode
- bin
- dist
- docs
- man
- tools
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- dogsled
- dupl
- errcheck
- exhaustive
- exportloopref
- goconst
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
- prealloc
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/lukasmalkmus/xxx
govet:
check-shadowing: true
Go environment
$ go version && go env
go version go1.15.4 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/lukasmalkmus/Library/Caches/go-build"
GOENV="/Users/lukasmalkmus/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/lukasmalkmus/Code/Go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/lukasmalkmus/Code/Go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/lukasmalkmus/Code/Private/xxx/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dy/s6dd70892l35f0444cwt96t40000gn/T/go-build856306592=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/lukasmalkmus/Code/Private/xxx /Users/lukasmalkmus/Code/Private /Users/lukasmalkmus/Code /Users/lukasmalkmus /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 27 linters: [bodyclose deadcode dogsled dupl errcheck exhaustive exportloopref goconst gofmt goimports golint gosec gosimple govet ineffassign misspell nolintlint prealloc staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (deps|exports_file|imports|name|types_sizes|compiled_files|files) took 12.275422ms
ERRO Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: build flag -mod=readonly only valid when using modules
INFO Memory: 2 samples, avg is 72.1MB, max is 72.1MB
INFO Execution took 25.264712ms
Build details above should be sufficient enough. TL;DR: latest macOS Catalina, golangci-lint 1.32.2
The error only occurs when using golang.org/x/tools v0.0.0-20201109182053-3db8fd265862
. When downgrading to v0.0.0-20201022035929-9cf592e881e9
it works just fine.