-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't workingdependenciesRelates to an upstream dependencyRelates to an upstream dependency
Description
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
It seems that golangci-lint (starting with v1.50?) passes the arguments to linters in lower case and not "as is".
This causes in our cases panic in revive
panic: Invalid argument to the context-as-argument rule. Unrecognized key allowtypesbefore goroutine 3957 [running]: github.com/mgechev/revive/rule.getAllowTypesFromArguments({0xc002f5eb30?, 0x0?, 0x0?}) /home/runner/go/pkg/mod/github.com/mgechev/revive@v1.2.4/rule/context-as-argument.go:98 +0x379 github.com/mgechev/revive/rule.(*ContextAsArgumentRule).Apply(0x22a5ac0, 0xc00146e300, {0xc002f5eb30?, 0x13?, 0x90a6c696e203d00?}) /home/runner/go/pkg/mod/github.com/mgechev/revive@v1.2.4/rule/context-as-argument.go:22 +0xa5 github.com/mgechev/revive/lint.(*File).lint(0xc00146e300, {0xc002f5ec50, 0x1, 0x1}, {0x0, 0x3fe999999999999a, {0x16cc8c0, 0x7}, 0x0, 0xc002f5ab70, ...}, ...) /home/runner/go/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/file.go:105 +0x19b github.com/mgechev/revive/lint.(*Package).lint.func1(0xc002b82480?) /home/runner/go/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/package.go:185 +0x85 created by github.com/mgechev/revive/lint.(*Package).lint /home/runner/go/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/package.go:184 +0xac which can be tracked down to: https://github.com/mgechev/revive/blob/v1.2.4/rule/context-as-argument.go#L82-L110.
The same config with the same code base works fine with v1.49
Version of golangci-lint
$ golangci-lint --version golangci-lint has version v1.50.0 built from (unknown, mod sum: "h1:+Xmyt8rKLauNLp2gzcxKMN8VNGqGc5Avc2ZLTwIOpEA=") on (unknown)Configuration file
$ cat .golangci.yml run: timeout: 5m linters: enable: - revive linters-settings: revive: rules: - name: context-as-argument arguments: - "allowTypesBefore": "*testing.T" issues: fix: trueGo environment
$ go version && go env go version go1.19.2 darwin/arm64 GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/USER/Library/Caches/go-build" GOENV="/Users/USER/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/USER/.gvm/pkgsets/go1.19.2/global" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/USER/.gvm/gos/go1.19.2" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/USER/.gvm/gos/go1.19.2/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.19.2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/USER/code_/gateway-operator/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/0m/_63w01516tgf3cftmp9h7ylm0000gn/T/go-build2415445190=/tmp/go-build -gno-record-gcc-switches -fno-common"Verbose output of running
$ golangci-lint cache clean $ golangci-lint run -v /Users/USER/code_/gateway-operator/bin/golangci-lint run -v level=info msg="[config_reader] Config search paths: [./ /Users/USER/code_/gateway-operator /Users/USER/code_ /Users/USER /Users /]" level=info msg="[config_reader] Used config file .golangci.yaml" level=info msg="[lintersdb] Active 28 linters: [asciicheck bodyclose depguard dogsled durationcheck errcheck errorlint exhaustive exportloopref gci gofmt goimports gosec gosimple govet importas ineffassign misspell nilerr nolintlint predeclared revive staticcheck typecheck unconvert unparam unused wastedassign]" level=info msg="[loader] Using build tags: [integration_tests e2e_tests]" level=info msg="[loader] Go packages loading at mode 575 (types_sizes|compiled_files|deps|exports_file|files|name|imports) took 325.019583ms" level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 6.31625ms" panic: Invalid argument to the context-as-argument rule. Unrecognized key allowtypesbefore goroutine 3381 [running]: github.com/mgechev/revive/rule.getAllowTypesFromArguments({0x140040fcd70?, 0x0?, 0x0?}) /Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod/github.com/mgechev/revive@v1.2.4/rule/context-as-argument.go:98 +0x34c github.com/mgechev/revive/rule.(*ContextAsArgumentRule).Apply(0x102513350, 0x14000ee4480, {0x140040fcd70?, 0x13?, 0x72616e552e637000?}) /Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod/github.com/mgechev/revive@v1.2.4/rule/context-as-argument.go:22 +0xe0 github.com/mgechev/revive/lint.(*File).lint(0x14000ee4480, {0x140040fce70, 0x1, 0x1}, {0x0, 0x3fe999999999999a, {0x1016d7002, 0x7}, 0x0, 0x14002836570, ...}, ...) /Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/file.go:105 +0x15c github.com/mgechev/revive/lint.(*Package).lint.func1(0x14004d4a170?) /Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/package.go:185 +0x70 created by github.com/mgechev/revive/lint.(*Package).lint /Users/USER/.gvm/pkgsets/go1.19.2/global/pkg/mod/github.com/mgechev/revive@v1.2.4/lint/package.go:184 +0xa8Code example or link to a public repository
// add your code heredecentralgabe and oliveromahony
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdependenciesRelates to an upstream dependencyRelates to an upstream dependency