Open ghost opened 3 months ago
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.
Hello,
You checked:
[x] Yes, I've included all the information above (version, config, etc.).
But you didn't provide the required minimal reproducible example or link to a public repository.
You can use the following option:
run:
go: '1.22'
To reproduce:
$ mkdir golangci
$ cd golangci
$ go work init
$ mkdir a b
$ echo module a > a/go.mod
$ echo go 1.20 >> a/go.mod
$ echo module b > b/go.mod
$ echo go 1.22 >> b/go.mod
$ echo package main > b/main.go
$ go work use a
$ go work use b
$ cd b
$ golangci-lint run --enable=copyloopvar,intrange
WARN [linters_context] copyloopvar: this linter is disabled because the Go version (1.20) of your project is lower than Go 1.22
WARN [linters_context] intrange: this linter is disabled because the Go version (1.20) of your project is lower than Go 1.22
This is very noticeable when leveraging generics and a version > 1.18, yielding predeclared any requires go1.18 or later (typecheck)
. Reverting to version 1.60.1 does not yield the incorrect error.
@TaylorBarrick I flagged your comment as offtopic because your error is not related to this issue.
I think it's related to this issue: https://github.com/golangci/golangci-lint/issues/4942 If it's not a duplicate you can open a new dedicated issue.
Welcome
typecheck
section of the FAQ.Description of the problem
go list -m -json
outputs multiple JSON documents when in a workspace, butgomoddirectives
only decodes the first one. That can lead togolangci-lint
wrongly complaininghttps://github.com/golangci/golangci-lint/blob/90664f6c85340d8a598e1d99a6dc4f318ea0c051/pkg/config/config.go#L79 https://github.com/ldez/gomoddirectives/blob/7ed1901522539e1461a03c3237fba32af0f70523/module.go#L24-L33
Version of golangci-lint
Configuration
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
Validation
Supporter