Skip to content

goanalysis_metalinter panics for generic internal package #2675

Closed
@BooleanCat

Description

@BooleanCat

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

Using golangci-lint run on github.com/BooleanCat/go-functional@v0.6.0 causes a panic with can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "assert" (isInitialPkg: true, needAnalyzeSource: true): T

Version of golangci-lint

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

Configuration file

No configuration file.

Go environment

go version go1.18 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tom/.cache/go-build"
GOENV="/home/tom/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tom/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tom/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go/1.18/libexec/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc-5"
CXX="g++-5"
CGO_ENABLED="1"
GOMOD="/home/tom/workspace/go-functional/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1747512551=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

go-functional on  main via 🐹 v1.18
❯ golangci-lint cache clean

go-functional on  main via 🐹 v1.18
❯ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/tom/workspace/go-functional /home/tom/workspace /home/tom /home /]
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (files|imports|compiled_files|deps|exports_file|types_sizes|name) took 102.794591ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.064331ms
INFO [linters context/goanalysis] analyzers took 1.790342082s with top 10 stages: buildir: 882.438536ms, inspect: 80.10901ms, fact_purity: 78.916084ms, nilness: 51.976695ms, fact_deprecated: 39.492546ms, ctrlflow: 36.976273ms, printf: 34.814299ms, SA5012: 29.734003ms, S1038: 26.053204ms, SA9001: 18.313678ms
ERRO [runner] Panic: buildir: package "assert" (isInitialPkg: true, needAnalyzeSource: true): T: goroutine 2503 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155
panic({0x142ab00, 0xc005edd500})
	runtime/panic.go:838 +0x207
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0020f2c40, {0x16e2710?, 0xc005edd500?}, 0x0)
	honnef.co/go/tools@v0.2.2/go/ir/methods.go:237 +0x5b1
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0020f2c40, {0x16e2670?, 0xc0032da180?}, 0x0)
	honnef.co/go/tools@v0.2.2/go/ir/methods.go:196 +0x347
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0020f2c40, {0x16e26e8?, 0xc00239e270?}, 0x0)
	honnef.co/go/tools@v0.2.2/go/ir/methods.go:233 +0x708
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0020f2c40, {0x16e2648?, 0xc00425cd00?}, 0x0)
	honnef.co/go/tools@v0.2.2/go/ir/methods.go:209 +0x448
honnef.co/go/tools/go/ir.(*Program).needMethodsOf(0xc0020f2c40, {0x16e2648?, 0xc00425cd00?})
	honnef.co/go/tools@v0.2.2/go/ir/methods.go:145 +0x70
honnef.co/go/tools/go/ir.(*Package).build(0xc0031cfb90)
	honnef.co/go/tools@v0.2.2/go/ir/builder.go:2375 +0x111
sync.(*Once).doSlow(0xc0020f2c40?, 0xc0007a7180?)
	sync/once.go:68 +0xc2
sync.(*Once).Do(...)
	sync/once.go:59
honnef.co/go/tools/go/ir.(*Package).Build(...)
	honnef.co/go/tools@v0.2.2/go/ir/builder.go:2363
honnef.co/go/tools/internal/passes/buildir.run(0xc0009a8270)
	honnef.co/go/tools@v0.2.2/internal/passes/buildir/buildir.go:86 +0x368
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc001270ca0)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0006e5180, {0x148bf31, 0x7}, 0xc002c68f48)
	github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)
	github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc001270ca0)
	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 +0x1eb
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "assert" (isInitialPkg: true, needAnalyzeSource: true): T
INFO [runner] processing took 3.107µs with stages: max_same_issues: 541ns, skip_dirs: 316ns, nolint: 274ns, cgo: 251ns, max_from_linter: 228ns, exclude: 187ns, autogenerated_exclude: 168ns, uniq_by_line: 145ns, skip_files: 145ns, filename_unadjuster: 141ns, path_prettifier: 140ns, max_per_file_from_linter: 128ns, exclude-rules: 61ns, diff: 60ns, path_shortener: 58ns, source_code: 55ns, sort_results: 54ns, identifier_marker: 52ns, path_prefixer: 52ns, severity-rules: 51ns
INFO [runner] linters took 1.016099767s with stages: goanalysis_metalinter: 1.016055393s
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "assert" (isInitialPkg: true, needAnalyzeSource: true): T

INFO Memory: 13 samples, avg is 165.8MB, max is 258.6MB
INFO Execution took 1.126868101s

Code example or link to a public repository

https://github.com/BooleanCat/go-functional

git clone github.com/BooleanCat/go-functional
cd go-functional
golangci-lint run

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions