golangci / golangci-lint

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

Broken cache causes error: [runner] Can't process result by autogenerated_exclude processor: can't filter issue... no such file or directory #3502

Open OscarVanL opened 1 year ago

OscarVanL commented 1 year ago

Welcome

Description of the problem

Sometimes after relocating a package during a refactor, there will be some very confusing linting failures. They will refer to the old (now non-existent) package directory.

I can reliably reproduce it over and over.

In the 'verbose output of running' section you will see lots of errors like this: build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative", this is not a folder that exists, I had just moved the storageutils package into a different location in the repository, and there is no reference to that path anywhere in the repository.

For some reason golangci-lint is getting refefences to a directory that no longer exists, I can only assume this is some stale cache somewhere. Notably, I have ran golangci-lint with no caching in CI for over a year and never experienced this error in CI, but recently enabled caching of the GOLANGCI_LINT_CACHE directory between runs and now experience this error in CI.

Version of golangci-lint

```console $ golangci-lint --version golangci-lint has version 1.49.0 built from cc2d97f3 on 2022-08-24T10:24:37Z ```

Configuration file

```console $ cat .golangci.yml run: timeout: 30m issues-exit-code: 1 tests: true skip-dirs-use-default: false skip-dirs: - (^|/)vendor($|/) - (^|/)third_party($|/) - (^|/)testdata($|/) - (^|/)Godeps($|/) - (^|/)builtin($|/) - (^|/)mocks($|/) - (^|/)mock($|/) allow-parallel-runners: false output: format: colored-line-number print-issued-lines: true print-linter-name: true uniq-by-line: true path-prefix: "" sort-results: true linters-settings: cyclop: max-complexity: 15 gocritic: enabled-checks: - builtinShadow - importShadow - typeUnparen goimports: local-prefixes: gitlab.com/ exhaustive: # check switch statements in generated files also check-generated: false # indicates that switch statements are to be considered exhaustive if a # 'default' case is present, even if all enum members aren't listed in the # switch default-signifies-exhaustive: true errchkjson: check-error-free-encoding: true report-no-exported: true gosec: # To select a subset of rules to run. # Available rules: https://github.com/securego/gosec#available-rules includes: - G101 #Look for hard coded credentials - G102 #Bind to all interfaces - G103 #Audit the use of unsafe block - G104 #Audit errors not checked - G106 #Audit the use of ssh.InsecureIgnoreHostKey - G107 #Url provided to HTTP request as taint input - G108 #Profiling endpoint automatically exposed on /debug/pprof - G109 #Potential Integer overflow made by strconv.Atoi result conversion to int16/32 - G110 #Potential DoS vulnerability via decompression bomb - G111 #Potential directory traversal - G112 #Potential slowloris attack - G113 #Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772) - G114 #Use of net/http serve function that has no support for setting timeouts - G201 #SQL query construction using format string - G202 #SQL query construction using string concatenation - G203 #Use of unescaped data in HTML templates - G204 #Audit use of command execution - G301 #Poor file permissions used when creating a directory - G302 #Poor file permissions used with chmod - G303 #Creating tempfile using a predictable path - G304 #File path provided as taint input - G305 #File traversal when extracting zip/tar archive - G306 #Poor file permissions used when writing to a new file - G307 #Deferring a method which returns an error - G401 #Detect the usage of DES, RC4, MD5 or SHA1 - G402 #Look for bad TLS connection settings - G403 #Ensure minimum RSA key length of 2048 bits - G404 #Insecure random number source (rand) - G501 #Import blocklist: crypto/md5 - G502 #Import blocklist: crypto/des - G503 #Import blocklist: crypto/rc4 - G504 #Import blocklist: net/http/cgi - G505 #Import blocklist: crypto/sha1 - G601 #Implicit memory aliasing of items from a range statement # To specify a set of rules to explicitly exclude. # Available rules: https://github.com/securego/gosec#available-rules excludes: # To specify the configuration of rules. # The configuration of rules is not fully documented by gosec: # https://github.com/securego/gosec#configuration # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102 config: G306: "0600" G101: ignore_entropy: false entropy_threshold: "80.0" per_char_threshold: "3.0" truncate: "32" gosimple: go: "1.19.1" # https://staticcheck.io/docs/options#checks checks: [ "all", "-S1023" ] govet: # report about shadowed variables check-shadowing: true revive: # see https://github.com/mgechev/revive#available-rules for details. ignore-generated-header: true severity: warning rules: - name: context-keys-type # Disallows the usage of basic types in `context.WithValue`. - name: time-naming # Conventions around the naming of time variables. - name: var-declaration # Reduces redundancies around variable declaration. - name: unexported-return # Warns when a public return is from unexported type. - name: errorf # Should replace `errors.New(fmt.Sprintf())` with `fmt.Errorf()`. - name: context-as-argument # `context.Context` should be the first argument of a function. - name: error-return # The error return parameter should be last. - name: error-strings # Conventions around error strings. - name: error-naming # Naming of error variables. - name: exported # Naming and commenting conventions on exported symbols. - name: if-return # Redundant if when returning an error. - name: var-naming # Naming rules. - name: package-comments # Package commenting conventions. - name: range # Prevents redundant variables when iterating over a collection. - name: indent-error-flow # Prevents redundant else statements. - name: empty-block # Warns on empty code blocks. - name: superfluous-else # Prevents redundant else statements (extend indent-error-flow). - name: modifies-parameter # Warns on assignments to function parameters. - name: unnecessary-stmt # Suggests removing or simplifying unnecessary statements. - name: struct-tag # Checks common struct tags like `json`,`xml`,`yaml`. - name: modifies-value-receiver # Warns on assignments to value-passed method receivers. - name: constant-logical-expr # Warns on constant logical expressions. - name: bool-literal-in-expr # Suggests removing Boolean literals from logic expressions. - name: redefines-builtin-id # Warns on redefinitions of builtin identifiers. - name: range-val-in-closure # Warns if range value is used in a closure dispatched as goroutine. - name: range-val-address # Warns if address of range value is used dangerously. - name: waitgroup-by-value # Warns on functions taking sync.WaitGroup as a by-value parameter. - name: atomic # Check for common mistaken usages of the `sync/atomic` package. - name: call-to-gc # Warns on explicit call to the garbage collector. - name: duplicated-imports # Looks for packages that are imported two or more times. - name: import-shadowing # Spots identifiers that shadow an import. - name: unused-receiver # Suggests to rename or remove unused method receivers. - name: string-of-int # Warns on suspicious casts from int to string. - name: unconditional-recursion # Warns on function calls that will lead to (direct) infinite recursion. - name: identical-branches # Spots if-then-else statements with identical `then` and `else` branches. - name: defer # Warns on some [defer gotchas](https://blog.learngoprogramming.com/5-gotchas-of-defer-in-go-golang-part-iii-36a1ab3d6ef1. - name: unexported-naming # Warns on wrongly named un-exported symbols. staticcheck: # Select the Go version to target. The default is '1.13'. go: "1.19.1" # https://staticcheck.io/docs/options#checks checks: [ "all" ] unused: # Select the Go version to target. The default is '1.13'. go: "1.19.1" varnamelen: max-distance: 20 ignore-names: - i - c - ok ignore-decls: - e error - ps pubsub.PubSub - r *http.Request - t testing.T - t *testing.T linters: disable-all: true enable: - asciicheck - bidichk - bodyclose - durationcheck - errcheck - errchkjson - exhaustive - exportloopref - goimports # also formats as is superset of gofmt - gosec - gosimple - govet - importas - ineffassign - makezero - nilerr - noctx - predeclared - staticcheck - thelper - typecheck - unconvert - unparam - unused - wastedassign ## Additional - cyclop # R's package check is altered but is a guess (by his own comment) - depguard # Nothing on R's - dogsled # R's is stricter, only allows one (compared to two) - dupl # R's is stricter, only allows 30 (compared to 100) but it is a guess - errname # Nothing on R's - errorlint # R's matches. To keep an eye on this as this gave Francesco issues with error wrapping. - forbidigo # R's matches - gochecknoglobals # Nothing on R's. - gochecknoinits # Nothing on R's. - gocognit # R's matches. - goconst # R's is stricter, min length of constant and number of instances is 2 instead of 3. - gocritic # R's is much much stricter. To come back to this, as there are a lot of settings here that are probably better discussed separately. - gocyclo # R's matches. - goerr113 # Nothing on R's. - goprintffuncname # Nothing on R's. - gosec # R's is much much stricter. To come back to this, as there are a lot of settings here that are probably better discussed separately. - ireturn # To keep an eye on this, it is good as a warning and we can account in settings. - lll # R's has. He only allows 110 chars instead of default 120. - nestif # Nothing on R's. To keep an eye on this, potentially want to make less strict. - nilnil # Nothing on R's. - promlinter # Nothing on R's. - rowserrcheck # Nothing on R's - revive # R's is much much stricter. To come back to this, as there are a lot of settings here that are probably better discussed separately. - sqlclosecheck - stylecheck - tenv - varnamelen issues: exclude: # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked # golint: False positive when tests are defined in package 'test' - func name will be used as test\.Test.* by other packages, and that stutters; consider calling this # govet: Common false positives - (possible misuse of unsafe.Pointer|should have signature) # staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore - ineffective break statement. Did you mean to break out of the outer loop # gosec: Too many false-positives on 'unsafe' usage - Use of unsafe calls should be audited # gosec: Too many false-positives for parametrized shell calls - Subprocess launch(ed with variable|ing should be audited) # gosec: Duplicated errcheck checks - G104 # gosec: Too many issues in popular repos - (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less) # gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)' - Potential file inclusion via variable exclude-rules: # Exclude some linters from running on tests files. - path: _test\.go linters: - bodyclose - cyclop - dupl - errcheck - funlen - gochecknoglobals - gocyclo - goerr113 - gosec - noctx - staticcheck - unparam - goconst # Exclude lll issues for long lines with go:generate - linters: - lll source: "^//go:generate " - linters: - lll source: "gitlab.com/" - linters: - revive text: "modifies-parameter" - linters: - revive text: "package-comments" exclude-use-default: false fix: false severity: default-severity: error case-sensitive: false rules: - linters: - dupl severity: info ```

Go environment

```console $ go version && go env go version go1.19 darwin/amd64 GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users//Library/Caches/go-build" GOENV="/Users//Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users//go/pkg/mod" GONOPROXY="gitlab.com/" GONOSUMDB="gitlab.com/" GOOS="darwin" GOPATH="/Users//go" GOPRIVATE="gitlab.com/" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/opt/go/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.19" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/z4/tjbsqpbj5pz3_mh9jzb4vhxw0000gn/T/go-build105497314=/tmp/go-build -gno-record-gcc-switches -fno-common" ```

Verbose output of running

```console $ golangci-lint cache clean $ golangci-lint run -v golangci-lint run --verbose --concurrency 4 --print-resources-usage --sort-results --config ../.golangci-recommended.yml < SEVERAL DIRECTORIES HERE> level=info msg="[config_reader] Used config file ../.golangci-recommended.yml" level=info msg="[lintersdb] Active 51 linters: [asciicheck bidichk bodyclose cyclop depguard dogsled dupl durationcheck errcheck errchkjson errname errorlint exhaustive exportloopref forbidigo gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo goerr113 goimports goprintffuncname gosec gosimple govet importas ineffassign ireturn lll makezero nestif nilerr nilnil noctx predeclared promlinter revive rowserrcheck sqlclosecheck staticcheck stylecheck tenv thelper typecheck unconvert unparam unused varnamelen wastedassign]" level=info msg="[loader] Go packages loading at mode 575 (deps|exports_file|files|imports|name|compiled_files|types_sizes) took 24.735819288s" level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 230.50324ms" level=info msg="[linters context] importas settings found, but no aliases listed. List aliases under alias: key." level=info msg="[linters context/goanalysis] analyzers took 4m57.266353488s with top 10 stages: buildir: 46.590492096s, buildssa: 39.245469046s, the_only_name: 27.180312838s, dupl: 22.735795786s, unconvert: 11.674113296s, S1038: 11.111755211s, goimports: 9.744917973s, gosec: 8.651967461s, varnamelen: 6.102163901s, bidichk: 6.007551691s" level=warning msg="[linters context] rowserrcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649." level=warning msg="[linters context] sqlclosecheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649." level=warning msg="[linters context] wastedassign is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649." level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner/skip dirs] Got abs path /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go in skip dirs processor, it should be relative" level=warning msg="[runner] Can't process result by autogenerated_exclude processor: can't filter issue result.Issue{FromLinter:\"ireturn\", Text:\"Bucket returns interface (gitlab.com//src/go-libs/extra/exp/storageutils/stiface.BucketHandle)\", Severity:\"\", SourceLines:[]string(nil), Replacement:(*result.Replacement)(nil), Pkg:(*packages.Package)(0xc000801c80), LineRange:(*result.Range)(nil), Pos:token.Position{Filename:\"/build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go\", Offset:1060, Line:42, Column:1}, HunkPos:0, ExpectNoLint:false, ExpectedNoLintLinter:\"\"}: failed to get doc of file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to parse file: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 42 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 56 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 107 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 136 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 154 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 182 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 196 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 210 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 224 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 239 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 254 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 268 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 282 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 338 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 396 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 452 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 495 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 509 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 523 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=warning msg="[runner/source_code] Failed to get line 556 for file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: failed to get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go lines cache: can't get file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go bytes from cache: can't read file /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: open /build/src/go-libs/extra/exp/storageutils/mocks/mock_gcp_storage.go: no such file or directory" level=info msg="[runner/max_same_issues] 16/19 issues with text \"File is not `goimports`-ed with -local gitlab.com/" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 8/11 issues with text \"don't use `init` function\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 6/9 issues with text \"var-naming: don't use an underscore in package name\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 5/8 issues with text \"line is 155 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 5/8 issues with text \"ST1000: at least one file in a package should have a package comment\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 4/7 issues with text \"line is 135 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 3/6 issues with text \"line is 131 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 2/5 issues with text \"line is 146 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 2/5 issues with text \"line is 130 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 2/5 issues with text \"line is 147 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 2/5 issues with text \"line is 125 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 1/4 issues with text \"line is 121 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 1/4 issues with text \"line is 132 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 1/4 issues with text \"line is 161 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_same_issues] 1/4 issues with text \"line is 152 characters\" were hidden, use --max-same-issues" level=info msg="[runner/max_from_linter] 573/623 issues from linter revive were hidden, use --max-issues-per-linter" level=info msg="[runner/max_from_linter] 55/105 issues from linter lll were hidden, use --max-issues-per-linter" level=info msg="[runner] Issues before processing: 3034, after processing: 141" level=info msg="[runner] Processors filtering stat (out/in): exclude-rules: 1859/2457, nolint: 1061/1859, severity-rules: 141/141, path_prefixer: 141/141, path_prettifier: 3034/3034, exclude: 2457/2752, uniq_by_line: 844/1061, max_per_file_from_linter: 833/844, max_same_issues: 769/833, skip_dirs: 2752/3034, skip_files: 3034/3034, identifier_marker: 2752/2752, source_code: 141/141, path_shortener: 141/141, cgo: 3034/3034, diff: 844/844, max_from_linter: 141/769, sort_results: 141/141, filename_unadjuster: 3034/3034" level=info msg="[runner] processing took 530.004793ms with stages: nolint: 210.973246ms, exclude: 160.133526ms, identifier_marker: 100.902183ms, exclude-rules: 31.040071ms, path_prettifier: 11.98745ms, skip_dirs: 7.718434ms, autogenerated_exclude: 2.811479ms, source_code: 2.064842ms, max_same_issues: 869.121µs, cgo: 416.645µs, filename_unadjuster: 341.471µs, uniq_by_line: 335.733µs, max_from_linter: 154.874µs, max_per_file_from_linter: 106.204µs, sort_results: 78.06µs, path_shortener: 52.324µs, severity-rules: 17.286µs, skip_files: 830ns, diff: 770ns, path_prefixer: 244ns" level=info msg="[runner] linters took 20.98810042s with stages: goanalysis_metalinter: 20.457615966s, rowserrcheck: 64.801µs, wastedassign: 14.34µs, sqlclosecheck: 13.941µs" level=info msg="File cache stats: 65 entries of total size 1.1MiB" level=info msg="Memory: 443 samples, avg is 242.1MB, max is 732.2MB" level=info msg="Execution took 45.983531353s" ```

Code example or link to a public repository

```go // add your code here ```
OscarVanL commented 1 year ago

I just updated to 1.50.1 and reproduced it on there too.

golangci-lint --version
golangci-lint has version v1.50.1 built from (unknown, mod sum: "h1:C829clMcZXEORakZlwpk7M4iDw2XiwxxKaG504SZ9zY=") on (unknown)
slessard commented 7 months ago

I just hit this same issue after relocating a package during a refactor. The command I ran was

golangci-lint run

Like @OscarVanL I was able to work around this issue by cleaning the cache

golangci-lint cache clean

But this was very confusing error and a bit hard to find the solution mentioned in this issue report.