-
-
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
The --fast flag does not overwrite the configuration file #1909
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, The Currently, I don't know if the behavior related to I need to think about it. main.gopackage main
import (
"net/http"
)
func main() {
println("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo")
req, err := http.NewRequest(http.MethodGet, "http://localhost:8080", nil)
if err != nil {
return
}
response, err := http.DefaultClient.Do(req)
if err != nil {
return
}
println(response.StatusCode)
} disable-all# .golangci.yml
linters:
disable-all: true
enable:
- lll # fast
- noctx # slow $ golangci-lint run
main.go:9: line is 127 characters (lll)
fmt.Println("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo")
main.go:11:29: should rewrite http.NewRequestWithContext or add (*Request).WithContext (noctx)
req, err := http.NewRequest(http.MethodGet, "http://localhost:8080", nil)
^ $ golangci-lint run --fast
main.go:9: line is 127 characters (lll)
fmt.Println("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo")
main.go:11:29: should rewrite http.NewRequestWithContext or add (*Request).WithContext (noctx)
req, err := http.NewRequest(http.MethodGet, "http://localhost:8080", nil)
^ enable-all# .golangci.yml
linters:
enable-all: true
disable:
- scopelint
- interfacer
- maligned $ golangci-lint run
main.go:8: line is 123 characters (lll)
println("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo")
main.go:15:40: response body must be closed (bodyclose)
response, err := http.DefaultClient.Do(req)
^
main.go:10:29: should rewrite http.NewRequestWithContext or add (*Request).WithContext (noctx)
req, err := http.NewRequest(http.MethodGet, "http://localhost:8080", nil)
^ $ golangci-lint run --fast
main.go:8: line is 123 characters (lll)
println("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo") |
I found the explanation in the code: golangci-lint/pkg/lint/lintersdb/enabled_set.go Lines 54 to 56 in 93df6f7
But the explanation seems weird:
So IMHO, the @golangci/team we have 3 choices:
I think this change will not break any people because, for me, it's the expected behavior. |
Hi @ldez, how are you doing? With my team, we also use the |
Something I wish I could do but I assumed I couldn't (I haven't looked into it yet) is to have vscode load a project's config file , add --fast to it to remove all the slow linters, then add my own set of potentially slow linters. The reason is that there are several linters that I think are useful, but I wouldn't use them on the CI and/or force them on other people (too opinionated, too many valid cases that break the rule, etc.). So the solution is to only enable them locally, and just for me. Now, we probably all think that --fast overrides everything so I think we should go ahead and make |
We have the same exact use case. The configuration is shared between CI and IDE, but we want to filter for the IDE case "slow" linters we enabled for CI, so that we can only have one configuration file. |
It seems like it has been a while since its been discussed but this issue is still relevant and causing problems. (Like in: https://github.com/github/super-linter/issues/3596 https://github.com/github/super-linter/issues/143 ) @ldez IDK if you guys discussed it yet but here is an opinion on the case: It seems like there are some negative opinions about how this kind of change can be breaking. How about creating a flag |
Fixed by #5475 |
Description of the problem
It seems that the flag
--fast
kind of doesn´t overwrite the lining configuration that lives in the configuration file. At the same time, I would like to keep the file configurations, but at the same time, IMHO the flag--fast
should have priority over the configuration file.Version of golangci-lint
Config file
Go environment
Verbose output of running
Code example or link to a public repository
// add your code here
The text was updated successfully, but these errors were encountered: