-
Hello, community. I've got a strange situation after upgrade to go1.22.5 linux/amd64 and golangci-lint 1.59.1 My local setup (EVERYTHING IS FINE):
go envGO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/vasiliy/.cache/go-build'
GOENV='/home/vasiliy/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/vasiliy/go/pkg/mod'
GONOPROXY='*.mycorp.com,pkg.re'
GONOSUMDB='*.mycorp.com,pkg.re'
GOOS='linux'
GOPATH='/home/vasiliy/go'
GOPRIVATE='*.mycorp.com,pkg.re'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/vasiliy/projects/my-service/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1986846863=/tmp/go-build -gno-record-gcc-switches' And the command
outputINFO golangci-lint has version 1.59.1 built with go1.22.3 from 1a55854a on 2024-06-09T18:08:33Z
INFO [config_reader] Config search paths: [./ /home/vasiliy/projects/my-project/my-service /home/vasiliy/projects/my-project /home/vasiliy/projects /home/vasiliy /home /]
INFO [config_reader] Used config file .golangci.yml
INFO maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
DEBU [exec] Locking on file /tmp/golangci-lint.lock...
DEBU [exec] Started tracking time
DEBU [env] Read go env for 1.974036ms: map[string]string{"GOCACHE":"/home/vasiliy/.cache/go-build", "GOROOT":"/usr/local/go"}
DEBU [enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{"cyclop", "dupl", "exhaustruct", "gci", "gocognit", "goconst", "gochecknoinits", "gocyclo", "godot", "godox", "gofumpt", "goimports", "goheader", "grouper", "funlen", "interfacebloat", "maintidx", "loggercheck", "lll", "nlreturn", "revive", "varnamelen", "wsl", "ireturn", "wrapcheck", "nilnil", "gomnd", "rowserrcheck", "sqlclosecheck", "wastedassign", "nonamedreturns", "gochecknoglobals", "tagliatelle", "contextcheck", "exhaustive", "govet", "staticcheck", "revive", "execinquery"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}
DEBU [enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{"cyclop", "dupl", "exhaustruct", "gci", "gocognit", "goconst", "gochecknoinits", "gocyclo", "godot", "godox", "gofumpt", "goimports", "goheader", "grouper", "funlen", "interfacebloat", "maintidx", "loggercheck", "lll", "nlreturn", "revive", "varnamelen", "wsl", "ireturn", "wrapcheck", "nilnil", "gomnd", "rowserrcheck", "sqlclosecheck", "wastedassign", "nonamedreturns", "gochecknoglobals", "tagliatelle", "contextcheck", "exhaustive", "govet", "staticcheck", "revive", "execinquery"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}
INFO [lintersdb] Active 70 linters: [asasalint asciicheck bidichk bodyclose canonicalheader containedctx copyloopvar decorder depguard dogsled dupword durationcheck err113 errcheck errchkjson errname errorlint exportloopref fatcontext forbidigo forcetypeassert ginkgolinter gocheckcompilerdirectives gochecksumtype gocritic gofmt gomoddirectives gomodguard goprintffuncname gosec gosimple gosmopolitan importas inamedparam ineffassign intrange makezero mirror misspell mnd musttag nakedret nestif nilerr noctx nolintlint nosprintfhostport paralleltest perfsprint prealloc predeclared promlinter protogetter reassign sloglint spancheck stylecheck tagalign tenv testableexamples testifylint testpackage thelper tparallel unconvert unparam unused usestdlibvars whitespace zerologlint]
DEBU [enabled_linters] Combined 71 go/analysis linters into one metalinter
INFO [loader] Go packages loading at mode 575 (compiled_files|exports_file|imports|types_sizes|deps|files|name) took 35.311684561s
DEBU [enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{"cyclop", "dupl", "exhaustruct", "gci", "gocognit", "goconst", "gochecknoinits", "gocyclo", "godot", "godox", "gofumpt", "goimports", "goheader", "grouper", "funlen", "interfacebloat", "maintidx", "loggercheck", "lll", "nlreturn", "revive", "varnamelen", "wsl", "ireturn", "wrapcheck", "nilnil", "gomnd", "rowserrcheck", "sqlclosecheck", "wastedassign", "nonamedreturns", "gochecknoglobals", "tagliatelle", "contextcheck", "exhaustive", "govet", "staticcheck", "revive", "execinquery"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 51.76312ms
INFO [linters_context/goanalysis] analyzers took 6m36.557738608s with top 10 stages: gocritic: 5m5.579273033s, buildir: 39.379205394s, unconvert: 9.528748282s, musttag: 6.798086816s, unparam: 4.88311799s, buildssa: 3.847962466s, gofmt: 1.653260115s, gosec: 1.540655118s, unused: 1.408418277s, S1038: 1.323592059s
INFO [runner] Issues before processing: 3993, after processing: 0
INFO [runner] Processors filtering stat (out/in): autogenerated_exclude: 952/952, identifier_marker: 952/952, filename_unadjuster: 3993/3993, exclude: 952/952, cgo: 3993/3993, path_prettifier: 952/952, skip_files: 952/952, exclude-rules: 0/952, invalid_issue: 952/3993, skip_dirs: 952/952
INFO [runner] processing took 11.198984ms with stages: identifier_marker: 8.44526ms, skip_files: 951.683µs, invalid_issue: 451.959µs, path_prettifier: 385.372µs, cgo: 285.588µs, filename_unadjuster: 254.892µs, exclude-rules: 149.062µs, skip_dirs: 122.973µs, exclude: 92.347µs, autogenerated_exclude: 54.171µs, nolint: 1.679µs, sort_results: 1.618µs, uniq_by_line: 546ns, max_same_issues: 422ns, fixer: 350ns, source_code: 183ns, max_from_linter: 176ns, diff: 158ns, max_per_file_from_linter: 154ns, path_shortener: 143ns, path_prefixer: 130ns, severity-rules: 118ns
INFO [runner] linters took 44.644491991s with stages: goanalysis_metalinter: 44.633186863s
0 issues.
INFO File cache stats: 1401 entries of total size 3.8MiB
DEBU [exec] Stopped resources tracking
INFO Memory: 760 samples, avg is 1324.2MB, max is 3929.9MB
INFO Execution took 1m20.011675424s The CI setup (HERE IS THE PROBLEM):
go envGO111MODULE=
GOARCH=amd64
GOBIN=
GOCACHE=/root/.cache/go-build
GOENV=/root/.config/go/env
GOEXE=
GOEXPERIMENT=
GOFLAGS=
GOHOSTARCH=amd64
GOHOSTOS=linux
GOINSECURE=
GOMODCACHE=/go/pkg/mod
GONOPROXY='*.my-corp.com,pkg.re'
GONOSUMDB='*.my-corp.com,pkg.re'
GOOS=linux
GOPATH=/go
GOPRIVATE='*.my-corp.com,pkg.re'
GOPROXY=https://my-corp-private-repo.com/,direct
GOROOT=/usr/local/go
GOSUMDB=sum.golang.org
GOTMPDIR=
GOTOOLCHAIN=auto
GOTOOLDIR=/usr/local/go/pkg/tool/linux_amd64
GOVCS=
GOVERSION=go1.22.5
GCCGO=gccgo
GOAMD64=v1
AR=ar
CC=gcc
CXX=g++
CGO_ENABLED=1
GOMOD=/builds/mayday/my-service/go.mod
GOWORK=
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG=pkg-config
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1344647284=/tmp/go-build -gno-record-gcc-switches'
GO111MODULE=on
GOPROXY=https://my-corp-private-repo.com/repository/go-group/,direct
GOPRIVATE='*.my-corp.com,pkg.re'
PATH=/opt/rh/devtoolset-8/root/usr/bin:/go/bin/:/go/bin:/usr/local/go/bin:/usr/local/bin:/usr/include:/usr/lib64/pkgconfig:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin And the command
outputGL_DEBUG=autogen_exclude,bin_salt,config_reader,enabled_linters,env,exclude_rules,exec,filename_unadjuster,invalid_issue,goenv,linter,linters_context,lintersdb,max_from_linter,max_same_issues,pkgcache,runner,severity_rules,skip_dirs,source_code,stopwatch,tab_printer,test,text_printer
+ golangci-lint run ./... --verbose --show-stats
level=info msg="golangci-lint has version 1.59.1 built with go1.22.3 from 1a55854a on 2024-06-09T18:08:33Z"
level=info msg="[config_reader] Config search paths: [./ /builds/mayday/my-project/my-service /builds/mayday/my-project /builds/mayday /builds / /root]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="maxprocs: Updating GOMAXPROCS=10: determined from CPU quota"
level=debug msg="[exec] Locking on file /tmp/golangci-lint.lock..."
level=debug msg="[exec] Started tracking time"
level=debug msg="[env] Read go env for 6.662177ms: map[string]string{\"GOCACHE\":\"/root/.cache/go-build\", \"GOROOT\":\"/usr/local/go\"}"
level=debug msg="[enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{\"cyclop\", \"dupl\", \"exhaustruct\", \"gci\", \"gocognit\", \"goconst\", \"gochecknoinits\", \"gocyclo\", \"godot\", \"godox\", \"gofumpt\", \"goimports\", \"goheader\", \"grouper\", \"funlen\", \"interfacebloat\", \"maintidx\", \"loggercheck\", \"lll\", \"nlreturn\", \"revive\", \"varnamelen\", \"wsl\", \"ireturn\", \"wrapcheck\", \"nilnil\", \"gomnd\", \"rowserrcheck\", \"sqlclosecheck\", \"wastedassign\", \"nonamedreturns\", \"gochecknoglobals\", \"tagliatelle\", \"contextcheck\", \"exhaustive\", \"govet\", \"staticcheck\", \"revive\", \"execinquery\"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}"
level=debug msg="[enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{\"cyclop\", \"dupl\", \"exhaustruct\", \"gci\", \"gocognit\", \"goconst\", \"gochecknoinits\", \"gocyclo\", \"godot\", \"godox\", \"gofumpt\", \"goimports\", \"goheader\", \"grouper\", \"funlen\", \"interfacebloat\", \"maintidx\", \"loggercheck\", \"lll\", \"nlreturn\", \"revive\", \"varnamelen\", \"wsl\", \"ireturn\", \"wrapcheck\", \"nilnil\", \"gomnd\", \"rowserrcheck\", \"sqlclosecheck\", \"wastedassign\", \"nonamedreturns\", \"gochecknoglobals\", \"tagliatelle\", \"contextcheck\", \"exhaustive\", \"govet\", \"staticcheck\", \"revive\", \"execinquery\"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}"
level=info msg="[lintersdb] Active 70 linters: [asasalint asciicheck bidichk bodyclose canonicalheader containedctx copyloopvar decorder depguard dogsled dupword durationcheck err113 errcheck errchkjson errname errorlint exportloopref fatcontext forbidigo forcetypeassert ginkgolinter gocheckcompilerdirectives gochecksumtype gocritic gofmt gomoddirectives gomodguard goprintffuncname gosec gosimple gosmopolitan importas inamedparam ineffassign intrange makezero mirror misspell mnd musttag nakedret nestif nilerr noctx nolintlint nosprintfhostport paralleltest perfsprint prealloc predeclared promlinter protogetter reassign sloglint spancheck stylecheck tagalign tenv testableexamples testifylint testpackage thelper tparallel unconvert unparam unused usestdlibvars whitespace zerologlint]"
level=debug msg="[enabled_linters] Combined 71 go/analysis linters into one metalinter"
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|exports_file|files|types_sizes|deps|imports|name) took 46.670449133s"
level=debug msg="[enabled_linters] Linters config: config.Linters{Enable:[]string(nil), Disable:[]string{\"cyclop\", \"dupl\", \"exhaustruct\", \"gci\", \"gocognit\", \"goconst\", \"gochecknoinits\", \"gocyclo\", \"godot\", \"godox\", \"gofumpt\", \"goimports\", \"goheader\", \"grouper\", \"funlen\", \"interfacebloat\", \"maintidx\", \"loggercheck\", \"lll\", \"nlreturn\", \"revive\", \"varnamelen\", \"wsl\", \"ireturn\", \"wrapcheck\", \"nilnil\", \"gomnd\", \"rowserrcheck\", \"sqlclosecheck\", \"wastedassign\", \"nonamedreturns\", \"gochecknoglobals\", \"tagliatelle\", \"contextcheck\", \"exhaustive\", \"govet\", \"staticcheck\", \"revive\", \"execinquery\"}, EnableAll:true, DisableAll:false, Fast:false, Presets:[]string(nil)}"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 68.993366ms"
level=info msg="[linters_context/goanalysis] analyzers took 11m31.551580423s with top 10 stages: gocritic: 6m55.07564344s, buildir: 2m34.170741873s, unconvert: 11.692974798s, buildssa: 10.923028621s, musttag: 8.365932941s, unparam: 7.985793737s, bidichk: 7.688437375s, inspect: 5.461975283s, gosec: 3.755802334s, importas: 2.842593921s"
level=debug msg="[autogen_exclude] doc contains marker \"code generated\": file is generated"
level=debug msg="[autogen_exclude] file \"src/modules/htmltopdf/mocks/mocks.go\" is generated: true"
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
level=debug msg="[autogen_exclude] file \"src/services/event/event_svg/event_data.go\" is generated: false"
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
level=debug msg="[autogen_exclude] file \"src/services/notification/notifications/vacation/event_finished_successfully_vacation.go\" is generated: false"
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
.
# LOTS OF THE SAME MESSAGES WITH [autogen_exclude] HERE
.
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
level=debug msg="[autogen_exclude] file \"src/services/telegram/http_telegram_service.go\" is generated: false"
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
level=debug msg="[autogen_exclude] file \"src/utils/time.go\" is generated: false"
level=debug msg="[autogen_exclude] doc of len 0 doesn't contain any of markers: [code generated do not edit autogenerated file]"
level=debug msg="[autogen_exclude] file \"src/services/attorney/generator/attorney_generator.go\" is generated: false"
level=info msg="[runner/skip_dirs] Skipped 3 issues from dir src/fixtures by pattern fixtures"
level=info msg="[runner/skip_dirs] Skipped 139 issues from dir src/app/config by pattern config"
level=info msg="[runner/skip_dirs] Skipped 25 issues from dir src/fixtures/employees by pattern fixtures"
level=info msg="[runner/skip_dirs] Skipped 2 issues from dir src/app/fixtures by pattern fixtures"
level=info msg="[runner] Issues before processing: 3014, after processing: 2426"
level=info msg="[runner] Processors filtering stat (out/in): nolint: 2618/2765, max_same_issues: 2426/2426, max_from_linter: 2426/2426, cgo: 3014/3014, filename_unadjuster: 3014/3014, autogenerated_exclude: 2780/2844, fixer: 2426/2426, sort_results: 2426/2426, invalid_issue: 3014/3014, exclude-rules: 2765/2780, max_per_file_from_linter: 2426/2426, exclude: 2780/2780, diff: 2426/2426, path_shortener: 2426/2426, path_prefixer: 2426/2426, path_prettifier: 3014/3014, skip_files: 3013/3014, skip_dirs: 2844/3013, severity-rules: 2426/2426, identifier_marker: 2780/2780, uniq_by_line: 2426/2618, source_code: 2426/2426"
level=info msg="[runner] processing took 464.680034ms with stages: nolint: 188.400922ms, exclude-rules: 135.368783ms, identifier_marker: 67.245165ms, autogenerated_exclude: 24.699512ms, source_code: 16.835812ms, path_prettifier: 13.836997ms, exclude: 7.015359ms, skip_files: 4.575926ms, skip_dirs: 2.29911ms, sort_results: 1.088455ms, path_shortener: 1.050368ms, uniq_by_line: 870.146µs, invalid_issue: 581.47µs, cgo: 383.691µs, filename_unadjuster: 242.986µs, max_per_file_from_linter: 180.399µs, fixer: 1.766µs, max_same_issues: 1.155µs, diff: 912ns, max_from_linter: 435ns, path_prefixer: 338ns, severity-rules: 327ns"
level=info msg="[runner] linters took 1m5.147119841s with stages: goanalysis_metalinter: 1m4.68214444s"
# LOTS OF ISSUES FROM LINTERS SKIPPED
2426 issues:
* copyloopvar: 6
* depguard: 54
* err113: 211
* gocritic: 28
* gosmopolitan: 9
* importas: 3
* inamedparam: 2
* ineffassign: 1
* intrange: 34
* mnd: 262
* musttag: 7
* nolintlint: 4
* perfsprint: 44
* protogetter: 1709
* tagalign: 40
* unused: 1
* usestdlibvars: 11
level=info msg="File cache stats: 1836 entries of total size 5.7MiB"
level=debug msg="[exec] Stopped resources tracking"
level=info msg="Memory: 1057 samples, avg is 1750.3MB, max is 4949.7MB"
level=info msg="Execution took 1m51.921747494s" Linter config (same for local, docker and CI setups)run:
concurrency: 0
timeout: 10m
tests: false
go: "1.22"
output:
sort-results: true
# see `golangci-lint linters`
linters:
disable-all: false
enable-all: true
disable:
- cyclop # temporary, too much noise, need a huge refactoring
- dupl # temporary, too much noise, need a huge refactoring
- exhaustruct # we don't require all struct fields to be initialized
- gci # style checks, package import order is not check in this project
- gocognit # temporary, too much noise, need a huge refactoring
- goconst # too much noise and false-positive
- gochecknoinits # decided to allow init functions
- gocyclo # temporary, too much noise, need a huge refactoring
- godot # require dots in each comment, quite useless
- godox # allow TODOs in comments
- gofumpt # gofumpt requires go 1.18 - we are on 1.16
- goimports # do not have clarity on imports for the service yet
- goheader # we do not require each file to have a special header
- grouper # lots of style changes
- funlen # temporary, too much noise, need a huge refactoring
- interfacebloat # we have lots of interfaces with > 5 methods
- maintidx # temporary, too much noise, need a huge refactoring
- loggercheck # we do not use these loggers
- lll # style check, not important at the moment
- nlreturn # just style (newline before each return)
- revive # if only we could disable all the linters, then our lives will be much easier
- varnamelen # we want short names for variables
- wsl # style checks
- ireturn # temporary, too much noise, need a huge refactoring
- wrapcheck # wrapped check, not important at the moment
- nilnil # because it's necessary case, but we have to refactor
- gomnd # unimportant case and we have to refactor
- rowserrcheck # is disabled because of generics
- sqlclosecheck # is disabled because of generics
- wastedassign # is disabled because of generics
- nonamedreturns # allowing named return
- gochecknoglobals # we often need global variables
- tagliatelle # temporary, too much noise, need a huge refactoring
- contextcheck # temporary, too much noise, need a huge refactoring
- exhaustive # temporary, too much noise, need a huge refactoring
- govet # temporary, too much noise, need a huge refactoring
- staticcheck # temporary, too much noise, need a huge refactoring
- revive
- execinquery # deprecated
# see https://golangci-lint.run/usage/linters/
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
linters-settings:
# HERE GOES ABOUT 900 LINES OF LINTERS CONFIGS - SKIPED HERE
issues:
exclude-rules:
- linters: [ typecheck ]
path: /
- path: _test\.go
linters:
- errcheck
- unparam
- gosec
- path: _test\.go
text: "use of `fmt.Println`"
exclude:
# see https://github.com/kyoh86/scopelint/issues/4#issuecomment-525540030
- Using the variable on range scope `tc` in function literal
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
# use to revert this setting: golangci-lint run --max-issues-per-linter int ./...
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
# use to revert this setting: golangci-lint run --max-same-issues int ./...
max-same-issues: 0
exclude-dirs:
- config
- deploy
- swagger
- migrations
- fixtures
- logs
exclude-files:
- ".*_mock\\.go" Final thoughtsVery suspicious entries from the linter output for me are: Why these numbers are different on the same linter version with the same config? And what would be your advice to tackle this problem in the CI setup? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 17 replies
-
Hello, can you try to run |
Beta Was this translation helpful? Give feedback.
can you run
golangci-lint cache clean
and re-run the command?In all cases, the issues excluded by
invalid_issues
are related to:All those problems are related to the same thing as
typecheck
, so you must fix your mocks.