-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
go-critic: checkers.init panic with go1.19beta1 #2922
Comments
Hello, Have you tried to run go-critic as a binary? |
I tried locally with go1.19beta1, and it works. IMO it's a duplicate of #2673 $ git clone [email protected]:opencontainers/runc.git
Cloning into 'runc'...
remote: Enumerating objects: 35414, done.
remote: Counting objects: 100% (292/292), done.
remote: Compressing objects: 100% (153/153), done.
remote: Total 35414 (delta 164), reused 227 (delta 133), pack-reused 35122
Receiving objects: 100% (35414/35414), 15.72 MiB | 5.56 MiB/s, done.
Resolving deltas: 100% (23351/23351), done.
$ cd runc
$ go version
go version go1.19beta1 linux/amd64
$ golangci-lint run
libcontainer/factory_linux.go:230:59: SA9008: e refers to the result of a failed type assertion and is a zero value, not the value that was being type-asserted (staticcheck)
err = fmt.Errorf("panic from initialization: %v, %s", e, debug.Stack())
^
libcontainer/factory_linux.go:226:7: SA9008(related information): this is the variable being read (staticcheck)
if e, ok := e.(error); ok {
^ |
Gocritic is not even enabled (nor do I need it). Also, the same setup works fine in CI with either go 1.16.x or go 1.17.x.
Does not work for me. Here's a complete repro: [kir@kir-rhat runc]$ go install golang.org/dl/go1.19beta1@latest
go: downloading golang.org/dl v0.0.0-20220609182932-6cd2f0e318f7
[kir@kir-rhat runc]$ go1.19beta1 download
<...skip....>
[kir@kir-rhat runc]$ ln -s /home/kir/go/bin/go1.19beta1 /home/kir/bin/go
[kir@kir-rhat runc]$ which go
~/bin/go
[kir@kir-rhat runc]$ go version
go version go1.19beta1 linux/amd64
[kir@kir-rhat runc]$ golangci-lint run ./...
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.22()
github.com/go-critic/[email protected]/checkers/embedded_rules.go:47 +0x4b4
[kir@kir-rhat runc]$ golangci-lint version
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.22()
github.com/go-critic/[email protected]/checkers/embedded_rules.go:47 +0x4b4 |
go-critic uses an init function you cannot disable that. |
This also seems like a dup for me. In case anyone lands here, I managed to use Go 1.19 + golangci-lint v1.47.3 by building from source, see #2673 (comment). |
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
This version works with go 1.19, i.e. it fixes golangci/golangci-lint#2922. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 0f4bf2c) Signed-off-by: Kir Kolyshkin <[email protected]>
Welcome
Description of the problem
When I try to use golangci-lint with go 1.19beta1 in GHA CI, I get:
Version of golangci-lint
1.46.2
Configuration file
not relevant
Go environment
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/runner/.cache/go-build"
GOENV="/home/runner/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/runner/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/runner/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/hostedtoolcache/go/1.19.0-beta.1/x64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/hostedtoolcache/go/1.19.0-beta.1/x64/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19beta1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/runner/work/runc/runc/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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build513076706=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
n/a
Code example or link to a public repository
See https://github.com/opencontainers/runc/runs/6923780174?check_suite_focus=true
opencontainers/runc#3514
The text was updated successfully, but these errors were encountered: