-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Typecheck linter only working despite all others being disabled and a non-typechek linter specified #5191
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
Comments
Hello, I recommend reading:
And providing a reproducible example. FYI, |
This is because you are using go1.18.
$ go version
go version go1.18.10 linux/amd64
$ golangci-lint version
golangci-lint has version 1.62.2 built with go1.23.3 from 89476e7a on 2024-11-25T14:16:01Z
$ golangci-lint run
foo.go:6:10: undefined: strings.CutPrefix (typecheck)
strings.CutPrefix("", "")
^ go.modmodule github.com/golangci/sandbox
go 1.18 foo.gopackage sandbox
import "strings"
func Foo() {
strings.CutPrefix("", "")
} Golangci-lint follows the same Go version policy than the Go team: https://golangci-lint.run/welcome/faq/#which-go-versions-are-supported |
Hi , please reopen this as it's still not answered. Thanks for un-earthing my old copy, the same problem is there, also unanswered. My issue is, why is golangci-lint insisting on only using the typecheck linter even though I'm specifically telling it not to? I don't care about typecheck. It seems unable to use the linter I'm asking it to use. |
You can see this as an API that returns users and their names in a key value format: {
"user1": "John Doe",
"user2": "Jane Doe"
} And if that API fails, it will use the same format: {
"error": "Something went wrong"
} This doesn't mean that there's a user named "error" and you can't ask to skip the user with username "error". You also can't expect "user1" and "user2" to be returned because the API simply failed to resolve the usernames. From the docs linked by @ldez:
The docs continue with a list of things to try to help troubleshoot why this happens. So if the code fails to build in a way that is required for Because of this, it's not possible to ever suppress reports labeled as What the docs and the above post is answer is how to figure out why your linter isn't running and why instead |
I think that I see @ldez lose his mental health by keep replying to questions about "typecheck issues". 658 so far The documentation is great. It can help to spot your issue. The reply made by @bombsimon is great. I'm a random Gopher, I actively follow what happen in this repository (and others) because I love golangci-lint. But even me is annoyed by the amount of messages/issues about typecheck. I wish maintainers could have more interesting to do than keep replying about "typecheck issues" For me,
This sentence could be added in h1 on golangci-lint homepage and issue template, I think they will keep coming. Please note, there is nothing wrong with you, or in reporting something issues, but please understand maintainers did their best to educate developers about what typecheck issues. |
I think this issue is about 3 elements:
The label But in the context of this issue, the report is related to type-checking because currently For example, with the same previous code: $ golangci-lint run --enable-only cyclop --show-stats
foo.go:6:10: undefined: strings.CutPrefix (typecheck)
strings.CutPrefix("", "")
^
1 issues:
* typecheck: 1
$ golangci-lint run --enable-only wsl --show-stats
0 issues. The linters that do not depend on types are flagged as "fast". $ golangci-lint linters | grep "^[a-z0-9]*:" | grep "fast: true" | sed 's/:/ /g' | awk '{print $1}' | sort
asciicheck
bidichk
copyloopvar
decorder
depguard
dogsled
dupl
dupword
forcetypeassert
funlen
gci
gocheckcompilerdirectives
gochecknoinits
gocognit
goconst
gocyclo
godot
godox
gofmt
gofumpt
goheader
goimports
gomoddirectives
gomodguard
goprintffuncname
grouper
inamedparam
ineffassign
interfacebloat
lll
maintidx
misspell
mnd
nakedret
nestif
nlreturn
nolintlint
nosprintfhostport
prealloc
predeclared
promlinter
tagalign
tagliatelle
testableexamples
testpackage
usestdlibvars
whitespace
wsl
|
Welcome
typecheck
section of the FAQ.Description of the problem
In multiple Go code repositories I run the following command:
$ golangci-lint run --disable-all -E cyclop
Expecting to disable all linters except cyclop. However the only results that are returned are all (typecheck). This happens if I change from cyclop to gosec or to any other linter.
Version of golangci-lint
Configuration
N/A- using the
--no-config
switch.Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
Not possible to share.
Validation
Supporter
The text was updated successfully, but these errors were encountered: