Open OscarVanL opened 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)
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.
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.
This is always solved by deleting my golangci-lint cache folder, or running
golangci-lint cache clean
. I believe it must be somehow related to stale caches.It only happens when I run golangci-lint against specific paths
golangci-lint --config .golangci.yml foo/...
, if I run it with no specified pathsgolangci-lint --config .golangci.yml
then it does not happen.I have not reproduced it with the standalone linter, as I have now cleared my cache. However, next time I experience this problem I will try running the standalone linter.
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 thestorageutils
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
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository