-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Make --fast
meaningful again
#1810
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
I created some benchmarks on the code of golangci-lintmedian: 4.29 (>= forcetypeassert) without stylecheck, unused, staticcheck, gosimple: median: 4.21 (>= errcheck) traefikmedian: 12.2s (>= thelper) without stylecheck, unused, staticcheck, gosimple: median: 12.01 (>= forcetypeassert) the script#!/bin/bash
linters=(
"asciicheck"
"bodyclose"
"cyclop"
"deadcode"
"depguard"
"dogsled"
"dupl"
"durationcheck"
"errcheck"
"errorlint"
"exhaustive"
"exhaustivestruct"
"exportloopref"
"forbidigo"
"forcetypeassert"
"funlen"
"gci"
"gochecknoglobals"
"gochecknoinits"
"gocognit"
"goconst"
"gocritic"
"gocyclo"
"godot"
"godox"
"goerr113"
"gofmt"
"gofumpt"
"goheader"
"goimports"
"golint"
"gomnd"
"gomodguard"
"goprintffuncname"
"gosec"
"gosimple"
"govet"
"ifshort"
"importas"
"ineffassign"
# "interfacer"
"lll"
"makezero"
# "maligned"
"misspell"
"nakedret"
"nestif"
"nilerr"
"nlreturn"
"noctx"
"nolintlint"
"paralleltest"
"prealloc"
"predeclared"
"revive"
"rowserrcheck"
"scopelint"
"sqlclosecheck"
"staticcheck"
"structcheck"
"stylecheck"
"testpackage"
"thelper"
"tparallel"
"typecheck"
"unconvert"
"unparam"
"unused"
"varcheck"
"wastedassign"
"whitespace"
"wrapcheck"
"wsl"
)
echo 'name,real,user,sys'
for item in "${linters[@]}"
do
golangci-lint cache clean
printf "$item,"
{ /usr/bin/time -q -f"%e,%U,%S" golangci-lint run --no-config --disable-all --print-issued-lines=false -E$item > /dev/null; } 2>&1
echo
done govet and staticcheck (unused, gosimple, stylecheck) contain multiple linters. Also, the cache has a huge impact on performances: with the cache 98% of the linters are fast. My conclusion: a simple binary state, like |
Wow, great work! Thanks for diving in on that. I see your point on the nuances of a One nice advantage to having such a toggle is that I can minimize configuration by "using" the same set of tests in a Makefile/CI and in my IDE, with the addition of the |
I analyzed the code related to the status
golangci-lint/pkg/lint/linter/config.go Lines 37 to 39 in 92adaa4
golangci-lint/pkg/lint/linter/config.go Lines 41 to 50 in 92adaa4
So all the linters are always considered as fast except golangci-lint/pkg/lint/lintersdb/manager.go Lines 151 to 157 in 92adaa4
There is no "replacement" for So, first I will remove the conditions related to the load mode in After I don't know what is the best way:
LoadMode overview
|
Thank you! |
Problem: When every linter claims it's fast, "fast" no longer has meaning:
I don't want to pick on anyone's work, but many of the linters are in fact quite slow. I wouldn't use many of them with IDE on-save functionality, anyway.
A couple ideas:
--fast
. This is probably not a good proposal.Thanks for the consideration.
The text was updated successfully, but these errors were encountered: