golangci / golangci-lint

Fast linters runner for Go
https://golangci-lint.run
GNU General Public License v3.0
15.64k stars 1.39k forks source link

periodically seen issue where lint failures are not reported #4872

Closed stan-stately closed 3 months ago

stan-stately commented 3 months ago

Welcome

Description of the problem

I've periodically seen issue where lint failures are not reported by golangci-lint. In these cases I have run a golangci-lint cache clean which caused the linter to start reporting the failures correctly again. This is concerning because the issue happened in my CI and I had linting failures make it into my main branch.

Version of golangci-lint

```console $ golangci-lint --version # golangci-lint has version v1.59.1 built with go1.22.3 from (unknown, modified: ?, mod sum: "h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks=") on (unknown) ```

Configuration

```console run: timeout: 5m tests: true modules-download-mode: readonly allow-parallel-runners: true go: "" output: sort-results: true linters: enable: - errcheck - gosimple - govet - ineffassign - staticcheck - unused - asasalint - bodyclose - depguard - durationcheck - errname - exportloopref - gocheckcompilerdirectives - gocritic - godot - gofumpt - gofmt - goprintffuncname - gosec - importas - misspell - nakedret - noctx - prealloc - predeclared - reassign - revive - stylecheck - unconvert - unparam - usestdlibvars - wastedassign - gci - forbidigo ```

Go environment

```console $ go version && go env go version go1.22.5 darwin/arm64 GO111MODULE='' GOARCH='arm64' GOBIN='/.local/share/mise/installs/go/1.22.3/bin' GOCACHE='/Library/Caches/go-build' GOENV='/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-arm64' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-arm64/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.22.5' GCCGO='gccgo' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='/go.work' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r3/pl_y4pgx031f53mt59y7kvmc0000gp/T/go-build320513934=/tmp/go-build -gno-record-gcc-switches -fno-common' ```

Verbose output of running

```console $ golangci-lint cache clean $ golangci-lint run -v INFO golangci-lint has version v1.59.1 built with go1.22.3 from (unknown, modified: ?, mod sum: "h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks=") on (unknown) INFO [config_reader] Config search paths: [./ / /] INFO [config_reader] Used config file ../.golangci.yaml INFO [lintersdb] Active 34 linters: [asasalint bodyclose depguard durationcheck errcheck errname exportloopref forbidigo gci gocheckcompilerdirectives gocritic godot gofmt gofumpt goprintffuncname gosec gosimple govet importas ineffassign misspell nakedret noctx prealloc predeclared reassign revive staticcheck stylecheck unconvert unparam unused usestdlibvars wastedassign] INFO [loader] Go packages loading at mode 575 (types_sizes|exports_file|files|imports|name|compiled_files|deps) took 719.611084ms INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 13.772917ms INFO [linters_context/goanalysis] analyzers took 3m6.670504804s with top 10 stages: gocritic: 1m10.60199246s, buildir: 41.007719425s, wastedassign: 9.951228455s, the_only_name: 7.039918085s, fact_deprecated: 3.02030044s, unconvert: 2.554245163s, printf: 2.192414565s, ctrlflow: 2.135914632s, inspect: 2.124014716s, buildssa: 1.844337131s INFO [runner] Issues before processing: 710, after processing: 0 INFO [runner] Processors filtering stat (out/in): identifier_marker: 223/223, filename_unadjuster: 710/710, skip_files: 710/710, skip_dirs: 710/710, autogenerated_exclude: 223/710, exclude: 223/223, exclude-rules: 26/223, nolint: 0/26, cgo: 710/710, invalid_issue: 710/710, path_prettifier: 710/710 INFO [runner] processing took 21.727873ms with stages: autogenerated_exclude: 9.083542ms, nolint: 4.248375ms, exclude-rules: 3.247667ms, path_prettifier: 2.470333ms, identifier_marker: 2.129833ms, skip_dirs: 420.958µs, invalid_issue: 62.083µs, cgo: 40.292µs, filename_unadjuster: 18.583µs, diff: 2.334µs, sort_results: 1.084µs, skip_files: 1.083µs, uniq_by_line: 375ns, max_same_issues: 333ns, fixer: 292ns, source_code: 249ns, exclude: 208ns, max_from_linter: 124ns, max_per_file_from_linter: 83ns, severity-rules: 42ns, path_shortener: 0s, path_prefixer: 0s INFO [runner] linters took 17.5195085s with stages: goanalysis_metalinter: 17.49770675s INFO File cache stats: 260 entries of total size 1.8MiB INFO Memory: 184 samples, avg is 1744.3MB, max is 3077.1MB INFO Execution took 18.264405083s ```

A minimal reproducible example or link to a public repository

I haven't been able to reliably reproduce this. its a transient issue

Validation

Supporter

boring-cyborg[bot] commented 3 months ago

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

ldez commented 3 months ago

Hello,

without something to reproduce, it's impossible to diagnose the problem.

It can be related to the same problem as #4423, but one again without something to reproduce, it's impossible to know.

stan-stately commented 3 months ago

give me an hr to try and repro

stan-stately commented 3 months ago

its not you. vscode is installing @latest which is competing with my mise installed shim. @latest has a new rule which is causing the failure