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

go-critic/ruleguard: compatibility with Go 1.18 #2414

Closed
4 tasks done
pierrre opened this issue Dec 15, 2021 · 14 comments
Closed
4 tasks done

go-critic/ruleguard: compatibility with Go 1.18 #2414

pierrre opened this issue Dec 15, 2021 · 14 comments
Labels
enhancement New feature or improvement

Comments

@pierrre
Copy link
Contributor

pierrre commented Dec 15, 2021

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

Go 1.18beta1 has been released.

When I run golangci-lint run I get:

panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt

goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.9()
	github.com/go-critic/go-critic@v0.6.1/checkers/checkers.go:58 +0x4b4

Version of golangci-lint

$ 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.9()
	github.com/go-critic/go-critic@v0.6.1/checkers/checkers.go:58 +0x4b4

But I'm using v1.43, installed with curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.43.0.

Configuration file

$ cat .golangci.yml

I'm not using any config file

Go environment

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

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt

goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.9()
	github.com/go-critic/go-critic@v0.6.1/checkers/checkers.go:58 +0x4b4

Code example or link to a public repository

// add your code here
@pierrre pierrre added the bug Something isn't working label Dec 15, 2021
@ldez ldez added enhancement New feature or improvement and removed bug Something isn't working labels Dec 15, 2021
@ldez ldez changed the title Compatibility with Go 1.18 go-critic/ruleguard: compatibility with Go 1.18 Dec 15, 2021
@ldez
Copy link
Member

ldez commented Dec 15, 2021

It's more an issue with go-critic/ruleguard than golangci-lint.

I recommend opening an issue on the go-critic repo.

@pierrre
Copy link
Contributor Author

pierrre commented Dec 15, 2021

Very strange, I've got exactly the same error messages as
go-critic/go-critic#1157
#2374

@Goldziher
Copy link

Well, I am using 1.18beta2, and this is still an issue. Furthermore, I cannot bypass it by disabling go-ciritc in the golangci-lint configs, because it seems its always loaded no matter what. This is my config:

linters-settings:
  goimports:
    local-prefixes: github.com/StreamElements/
  govet:
    check-shadowing: true
linters:
  disable:
    - gocritic
  enable:
    - bidichk
    - deadcode
    - durationcheck
    - errcheck
    - errorlint
    - exportloopref
    - goimports
    - goconst
    # - gocritic
    - godot
    - godox
    - goheader
    - gomoddirectives
    - gomodguard
    - goprintffuncname
    - gosec
    - ineffassign
    - gosimple
    - govet
    - nolintlint
    - predeclared
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - structcheck
    - tenv
    - testpackage
    - typecheck
    - unconvert
    - unparam
    - unused
    - varcheck
    - wastedassign
    - whitespace
issues:
  fix: true

And this is what I am getting on the command line (running using pre-commit):

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()
	/Users/naamanhirschfeld/.cache/pre-commit/reposlmx3ef2/golangenv-default/pkg/mod/github.com/go-critic/go-critic@v0.6.2/checkers/embedded_rules.go:46 +0x52c

@ldez
Copy link
Member

ldez commented Mar 6, 2022

Take a look at #2438

@Goldziher
Copy link

would be lovely to see this released :)

@EwenQuim
Copy link

Furthermore, I cannot bypass it by disabling go-critic in the golangci-lint configs, because it seems its always loaded no matter what.

Same issue here, it really bugs me as I am not even using go-critic...
Thanks for #2438, will be watching it closely! :)

@tehsphinx
Copy link

tehsphinx commented Mar 16, 2022

Since go1.18 is released now, can we up the prio on this? Maybe tag it with Bug?

@ldez
Copy link
Member

ldez commented Mar 16, 2022

Take a look at #2438.

Yes go1.18 is released but the tooling provided by Go is not ready, it's not our fault.

I will close this issue in favor of the PR.

@ldez ldez closed this as completed Mar 16, 2022
@atombender
Copy link

The issue should stay open until PR is merged.

@ldez
Copy link
Member

ldez commented Mar 16, 2022

The issue should stay open until PR is merged.

This issue is only about ruleguard but the problem is global.

The PR provides information and details for all the linters, not only one.

We can open a global issue but we will say the same things as in the PR.

@atombender
Copy link

A single tracking issue for Go 1.18 would be great. There may need to be multiple PRs, and PRs typically have too much chatter about the actual work.

@ldez
Copy link
Member

ldez commented Mar 16, 2022

There may need to be multiple PRs, and PRs typically have too much chatter about the actual work.

I don't think so because the problem is related to only one thing: the SSA analyzer.

If you want to help, you can contribute to solving this issue golang/go#48525

@ldez
Copy link
Member

ldez commented Mar 16, 2022

I will open an issue because I feel like we will have to repeat too much time the same thing on different issues.

@ldez
Copy link
Member

ldez commented Mar 16, 2022

#2649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

6 participants