Closed
Description
- 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/)
Dependency exportloopref Panic
When running golangci-lint in jenkins, builds are failing as a result of a panic in the library exportloopref.
Version of golangci-lint
$ golangci-lint --version
1.37.1
Config file
$ cat .golangci.yml
level=warning msg="No config file detected"
Go environment
$ go version && go env
go version go1.16.2 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/robert.hird/Library/Caches/go-build"
GOENV="/Users/robert.hird/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/robert.hird/go/pkg/mod"
GONOPROXY=-------
GONOSUMDB=-------
GOOS="darwin"
GOPATH="/Users/robert.hird/go"
GOPRIVATE=-------
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=-------
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/wn/qqwqkfqx0vn9w9mzclmkmf080000gp/T/go-build610424095=/tmp/go-build -gno-record-gcc-switches -fno-common"
Output of error
[2021-03-31T16:06:22.161Z] + golangci-lint run -c ./golangci.yaml [2021-03-31T16:06:48.663Z] level=warning msg="[linters context]
Panic: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 8231 [running]:\nruntime/debug.Stack(0xf2d9bd, 0x3c, 0xc002296578)
\n\truntime/debug/stack.go:24 +0x9f\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1(0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:508
+0x1be\npanic(0xd76f60, 0x1541d70)\n\truntime/panic.go:965 +0x1b9\ngo/ast.(*Object).Pos(0x0, 0xc002296c20)\n\tgo/ast/scope.go:93 +0x29\ngithub.com/kyoh86/exportloopref.(*Searcher).isVar(0xc002296bf0,
0x10429d8, 0xc00c41eff0, 0x104b930, 0xc00f0cc6a0,
0xc00c41eff0)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:275 +0xb0\ngithub.com/kyoh86/exportloopref.(*Searcher).checkUnaryExpr(0xc002296bf0, 0xc00f0cc700, 0xc0000d6200, 0xd, 0x10, 0x0, 0x0,
0xf5a401)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:251 +0x3b8\ngithub.com/kyoh86/exportloopref.(*Searcher).Check(0xc002296bf0, 0x1042c58, 0xc00f0cc700, 0xc0000d6200, 0xd, 0x10, 0x0, 0x0,
0xc002296a01)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:100 +0xee\ngithub.com/kyoh86/exportloopref.run.func1(0x1042c58, 0xc00f0cc700, 0x1, 0xc0000d6200, 0xd, 0x10, 0x1)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:46 +0x8c\ngolang.org/x/tools/go/ast/inspector.(*Inspector).WithStack(0xc01ced4090, 0xc002296c80, 0x5, 0x5,
0xc00aab9c08)\n\tgolang.org/x/tools@v0.1.0/go/ast/inspector/inspector.go:126
+0x142\ngithub.com/kyoh86/exportloopref.run(0xc00dcfdee0, 0x592ac3264, 0x164e260, 0xc00871dbb8, 0x2)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:45 +0x28b\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:590 +0xa85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.
(*action).analyzeSafe.func2()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:512 +0x2a\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc001e58500, 0xee921b, 0xd, 0xc0037cb770)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4d\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0038a1390)\n\tgithub.com/golangci/golangci-
lint/pkg/golinters/goanalysis/runner.go:511 +0x91\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc00c73be50, 0xc0038a1390)\n\tgithub.com/golangci/golangci-
lint/pkg/golinters/goanalysis/runner.go:1059 +0x65\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1054 +0x316\n" [2021-
03-31T16:06:48.663Z] level=warning msg="[runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference" [2021-03-31T16:06:48.663Z] level=error msg="Running error: goanalysis_metalinter: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference" script returned exit code 3