Skip to content

Go 1.18: Panic: buildir: package "provider" #2664

Closed
@andig

Description

@andig

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 included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

Linting panics:

❯ make lint
golangci-lint run
ERRO [runner] Panic: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T: goroutine 15062 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x68
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x104
panic({0x10347b000, 0x14004251620})
	runtime/panic.go:838 +0x204
honnef.co/go/tools/go/ir.(*Program).needMethods(0x14001a620e0, {0x1034e1688?, 0x14004251620?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:237 +0x524
honnef.co/go/tools/go/ir.(*Program).needMethods(0x14001a620e0, {0x1034e1660?, 0x140078a9440?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:233 +0x600
honnef.co/go/tools/go/ir.(*Program).needMethods(0x14001a620e0, {0x1034e15c0?, 0x140078cb1c0?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:210 +0x3e8
honnef.co/go/tools/go/ir.(*Program).needMethods(0x14001a620e0, {0x1034e1660?, 0x140078a9470?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:233 +0x600
honnef.co/go/tools/go/ir.(*Program).needMethods(0x14001a620e0, {0x1034e15c0?, 0x140078cb140?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:209 +0x3cc
honnef.co/go/tools/go/ir.(*Program).needMethodsOf(0x14005ae3af0?, {0x1034e15c0?, 0x140078cb140?})
	honnef.co/go/[email protected]/go/ir/methods.go:145 +0xb4
honnef.co/go/tools/go/ir.(*Package).build(0x140082fbc20)
	honnef.co/go/[email protected]/go/ir/builder.go:2375 +0xd8
sync.(*Once).doSlow(0x14001a620e0?, 0x140078b4000?)
	sync/once.go:68 +0x10c
sync.(*Once).Do(...)
	sync/once.go:59
honnef.co/go/tools/go/ir.(*Package).Build(...)
	honnef.co/go/[email protected]/go/ir/builder.go:2363
honnef.co/go/tools/internal/passes/buildir.run(0x1400858c820)
	honnef.co/go/[email protected]/internal/passes/buildir/buildir.go:86 +0x28c
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0x14003332320)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x96c
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x24
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0x14000aafea0, {0x10307f191, 0x7}, 0x14002b76f30)
	github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x48
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x102c64e00?)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x78
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0x14003332320)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x16c
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.45.0 built from 1f4c1ed on 2022-03-18T14:35:36Z```

Configuration file

$ cat .golangci.yml
issues:
  exclude:
  - .regActualCurrent. is unused
  - "`routeLogger` is unused"

Go environment

$ go version && go envgo version && go env
go version go1.18 darwin/arm64
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/andig/Library/Caches/go-build"
GOENV="/Users/andig/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/andig/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/andig/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/andig/htdocs/evcc/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build1021287890=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -vgolangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/andig/htdocs/evcc /Users/andig/htdocs /Users/andig /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (imports|deps|exports_file|name|types_sizes|compiled_files|files) took 1.30858525s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 12.684708ms
INFO [linters context/goanalysis] analyzers took 32.382452156s with top 10 stages: buildir: 17.937472259s, fact_deprecated: 1.573165623s, inspect: 1.345512898s, printf: 1.162804344s, ctrlflow: 889.364007ms, nilness: 852.838036ms, fact_purity: 683.247877ms, typedness: 543.268471ms, SA5012: 408.588546ms, directives: 176.904082ms
ERRO [runner] Panic: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T: goroutine 23246 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x68
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x104
panic({0x103547000, 0x14019e57c20})
	runtime/panic.go:838 +0x204
honnef.co/go/tools/go/ir.(*Program).needMethods(0x140079d4d20, {0x1035ad688?, 0x14019e57c20?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:237 +0x524
honnef.co/go/tools/go/ir.(*Program).needMethods(0x140079d4d20, {0x1035ad660?, 0x1400fdedd70?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:233 +0x600
honnef.co/go/tools/go/ir.(*Program).needMethods(0x140079d4d20, {0x1035ad5c0?, 0x1400de7b340?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:210 +0x3e8
honnef.co/go/tools/go/ir.(*Program).needMethods(0x140079d4d20, {0x1035ad660?, 0x1400fdedda0?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:233 +0x600
honnef.co/go/tools/go/ir.(*Program).needMethods(0x140079d4d20, {0x1035ad5c0?, 0x1400de7b2c0?}, 0x0)
	honnef.co/go/[email protected]/go/ir/methods.go:209 +0x3cc
honnef.co/go/tools/go/ir.(*Program).needMethodsOf(0x1400410e690?, {0x1035ad5c0?, 0x1400de7b2c0?})
	honnef.co/go/[email protected]/go/ir/methods.go:145 +0xb4
honnef.co/go/tools/go/ir.(*Package).build(0x1401f6a2360)
	honnef.co/go/[email protected]/go/ir/builder.go:2375 +0xd8
sync.(*Once).doSlow(0x140079d4d20?, 0x140198d14f0?)
	sync/once.go:68 +0x10c
sync.(*Once).Do(...)
	sync/once.go:59
honnef.co/go/tools/go/ir.(*Package).Build(...)
	honnef.co/go/[email protected]/go/ir/builder.go:2363
honnef.co/go/tools/internal/passes/buildir.run(0x1401fc304e0)
	honnef.co/go/[email protected]/internal/passes/buildir/buildir.go:86 +0x28c
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0x14002966700)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x96c
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x24
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0x14000120a00, {0x10314b191, 0x7}, 0x14001793730)
	github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x48
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x102d30e00?)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x78
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0x14002966700)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x16c
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T
INFO [runner] processing took 2.624µs with stages: max_same_issues: 625ns, max_from_linter: 292ns, nolint: 250ns, cgo: 250ns, skip_files: 209ns, skip_dirs: 167ns, filename_unadjuster: 125ns, max_per_file_from_linter: 83ns, identifier_marker: 83ns, exclude: 83ns, path_shortener: 83ns, path_prettifier: 83ns, exclude-rules: 42ns, severity-rules: 42ns, path_prefixer: 42ns, uniq_by_line: 42ns, autogenerated_exclude: 41ns, source_code: 41ns, sort_results: 41ns, diff: 0s
INFO [runner] linters took 4.732210875s with stages: goanalysis_metalinter: 4.732177375s
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "provider" (isInitialPkg: false, needAnalyzeSource: true): T

INFO Memory: 62 samples, avg is 585.2MB, max is 854.8MB
INFO Execution took 6.060550333s

Code example or link to a public repository

Code is here: evcc-io/evcc#2116

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions