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 1.24.0 built from 6fd4383 on 2020-03-15T11:25:03Z
Config file
$ cat .golangci.yml
linters:
enable-all: true
linters-settings:
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
- github.com/powerman/sqlxx
Go environment
$ go version && go env
go version go1.14.1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/powerman/.cache/go-build"
GOENV="/home/powerman/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/powerman/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="x86_64-pc-linux-gnu-g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build919401820=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /home/powerman/tmp/rowserrcheck-bug /home/powerman/tmp /home/powerman /home /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 41 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc rowserrcheck scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace wsl]"
level=info msg="[lintersdb] Active 41 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc rowserrcheck scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace wsl]"
level=info msg="[loader] Go packages loading at mode 575 (deps|compiled_files|exports_file|files|imports|name|types_sizes) took 58.062109ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 78.633µs"
level=info msg="[runner/goanalysis_metalinter/goanalysis] analyzers took 15.418848ms with top 10 stages: dupl: 1.283183ms, buildssa: 1.042268ms, buildir: 897.041µs, interfacer: 486.111µs, gocritic: 350.864µs, unconvert: 349.42µs, SA5001: 333.612µs, SA3001: 325.567µs, unmarshal: 299.858µs, buildtag: 296.492µs"
level=warning msg="[linters context] Panic: rowserrcheck: package \"bug\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 591 [running]:\nruntime/debug.Stack(0x13488c2, 0x3c, 0xc00007d9b0)\n\t/usr/lib/go/src/runtime/debug/stack.go:24 +0x9d\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1(0xc0017df390)\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:528 +0x1b5\npanic(0x1189b60, 0x1aedf10)\n\t/usr/lib/go/src/runtime/panic.go:967 +0x166\ngolang.org/x/tools/go/ssa.(*Type).Object(...)\n\t/home/powerman/go/pkg/mod/golang.org/x/tools@v0.0.0-20200204192400-7124308813f3/go/ssa/ssa.go:1467\ngithub.com/jingyugao/rowserrcheck/passes/rowserr.runner.run(0xc001c36960, 0x0, 0x0, 0x0, 0x0, 0xc000254740, 0x3, 0x4, 0xc001c36960, 0xc00015f9e0, ...)\n\t/home/powerman/go/pkg/mod/github.com/jingyugao/rowserrcheck@v0.0.0-20191204022205-72ab7603b68a/passes/rowserr/rowserr.go:65 +0x126\ngithub.com/jingyugao/rowserrcheck/passes/rowserr.NewRun.func1(0xc001c36960, 0xc1125d9, 0x1c8ffe0, 0xc0009a8850, 0x2)\n\t/home/powerman/go/pkg/mod/github.com/jingyugao/rowserrcheck@v0.0.0-20191204022205-72ab7603b68a/passes/rowserr/rowserr.go:46 +0x160\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0017df390)\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:610 +0xa25\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:532 +0x2a\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0016e5540, 0x12faddd, 0xc, 0xc0017f2770)\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x50\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0017df390)\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:531 +0x91\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func3(0xc0028bacd0, 0xc0017df390)\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1076 +0x61\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\t/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1071 +0x309\n"
level=info msg="[runner/unused/goanalysis] analyzers took 0s with no stages"
level=info msg="[runner] processing took 2.676µs with stages: max_same_issues: 739ns, diff: 356ns, skip_dirs: 257ns, nolint: 210ns, max_from_linter: 187ns, cgo: 123ns, filename_unadjuster: 89ns, identifier_marker: 87ns, path_prettifier: 87ns, source_code: 86ns, max_per_file_from_linter: 84ns, skip_files: 81ns, exclude: 77ns, uniq_by_line: 55ns, path_shortener: 54ns, exclude-rules: 52ns, autogenerated_exclude: 52ns"
level=info msg="[runner] linters took 79.726185ms with stages: goanalysis_metalinter: 79.511217ms, unused: 174.52µs"
level=info msg="File cache stats: 1 entries of total size 131B"
level=info msg="Memory: 3 samples, avg is 70.8MB, max is 71.1MB"
level=info msg="Execution took 142.893346ms"
This is the code which triggers the panic:
package bug
import (
"github.com/jmoiron/sqlx"
"github.com/powerman/sqlxx"
)
func Setup() {
sqlx.NameMapper = sqlxx.ToSnake
}
Panic is:
WARN [linters context] Panic: rowserrcheck: package "bug" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 759 [running]:
runtime/debug.Stack(0x13488c2, 0x3c, 0xc0025899b0)
/usr/lib/go/src/runtime/debug/stack.go:24 +0x9d
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1(0xc00140f660)
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:528 +0x1b5
panic(0x1189b60, 0x1aedf10)
/usr/lib/go/src/runtime/panic.go:967 +0x166
golang.org/x/tools/go/ssa.(*Type).Object(...)
/home/powerman/go/pkg/mod/golang.org/x/tools@v0.0.0-20200204192400-7124308813f3/go/ssa/ssa.go:1467
github.com/jingyugao/rowserrcheck/passes/rowserr.runner.run(0xc0025915e0, 0x0, 0x0, 0x0, 0x0, 0xc00015fdc0, 0x3, 0x4, 0xc0025915e0, 0xc00068a240, ...)
/home/powerman/go/pkg/mod/github.com/jingyugao/rowserrcheck@v0.0.0-20191204022205-72ab7603b68a/passes/rowserr/rowserr.go:65 +0x126
github.com/jingyugao/rowserrcheck/passes/rowserr.NewRun.func1(0xc0025915e0, 0xbbe3885, 0x1c8ffe0, 0xc000e56e70, 0x2)
/home/powerman/go/pkg/mod/github.com/jingyugao/rowserrcheck@v0.0.0-20191204022205-72ab7603b68a/passes/rowserr/rowserr.go:46 +0x160
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc00140f660)
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:610 +0xa25
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:532 +0x2a
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0013d34f0, 0x12faddd, 0xc, 0xc0024aef70)
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x50
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc00140f660)
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:531 +0x91
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func3(0xc002ab77e0, 0xc00140f660)
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1076 +0x61
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
/home/powerman/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1071 +0x309
Removing line - github.com/powerman/sqlxx
from .golangci.yml
fixes the issue, but to me it looks like this line is valid.