Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic: buildssa: package "randx" (isInitialPkg: true, needAnalyzeSource: true) #2679

Closed
4 tasks done
lx-world opened this issue Mar 24, 2022 · 2 comments
Closed
4 tasks done
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@lx-world
Copy link

lx-world commented Mar 24, 2022

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

Error running golangci-lint run

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.45.0 built from (unknown, mod sum: "h1:T2oCVkYoeckBxcNS6DTYiSXN2QcTNuAWaHyLGfqzMlU=") on (unknown)

Configuration file

$ cat .golangci.yml
# paste output here

Go environment

$ go version && go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE=".cache/go-build"
GOENV=".config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK="go.work"
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-build1941441636=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
ERRO [runner] Panic: buildssa: package "randx" (isInitialPkg: true, needAnalyzeSource: true): E: goroutine 20344 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:101 +0x155
panic({0x142bae0, 0xc0076eed50})
        /usr/local/go/src/runtime/panic.go:838 +0x207
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc009842dd0, {0x16e36d0?, 0xc0076eed50?}, 0x0)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:237 +0x5b1
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc009842dd0, {0x16e36a8?, 0xc005142660?}, 0x0)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:233 +0x708
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc009842dd0, {0x16e3608?, 0xc010e986c0?}, 0x0)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:209 +0x448
golang.org/x/tools/go/ssa.(*Program).needMethodsOf(0xc009842dd0, {0x16e3608?, 0xc010e986c0?})
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:145 +0x70
golang.org/x/tools/go/ssa.(*Package).build(0xc006e87b00)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/builder.go:2284 +0x111
sync.(*Once).doSlow(0xc009842dd0?, 0xc009b17a40?)
        /usr/local/go/src/sync/once.go:68 +0xc2
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:59
golang.org/x/tools/go/ssa.(*Package).Build(...)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/builder.go:2272
golang.org/x/tools/go/analysis/passes/buildssa.run(0xc009842c30)
        /home/f/go/pkg/mod/golang.org/x/tools@v0.1.10/go/analysis/passes/buildssa/buildssa.go:72 +0x2ee
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc003d91a10)
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:105 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc000a54870, {0x149743f, 0x8}, 0xc003c44f48)
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc00092b3e0?)
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:104 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc003d91a10)
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        /home/f/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildssa: package "randx" (isInitialPkg: true, needAnalyzeSource: true): E
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: goanalysis_metalinter: buildssa: package "randx" (isInitialPkg: true, needAnalyzeSource: true): E

Code example or link to a public repository

// add your code here
@lx-world lx-world added the bug Something isn't working label Mar 24, 2022
@ldez
Copy link
Member

ldez commented Mar 24, 2022

Hello,

As I explained here and here, if you are using generics you have to set the following configuration:

run:
    go: 1.18

https://golangci-lint.run/usage/configuration/#run-configuration

@ldez ldez closed this as completed Mar 24, 2022
@ldez ldez added the duplicate This issue or pull request already exists label Mar 24, 2022
@lx-world
Copy link
Author

lx-world commented Mar 24, 2022

ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants