golangci-lint-action icon indicating copy to clipboard operation
golangci-lint-action copied to clipboard

No annotation created if cache exists

Open ishikawa opened this issue 2 years ago • 6 comments

We're facing a problem that the golangci-lint-action correctly works and found some issues in the PR code, but it won't produce any annotations in the PR. After some investigation, we found that there are many "File exists" errors when decompressing its cache. It prevents GitHub Action from creating annotations to the PR. To resolve this problem, we have to opt-out caches by specifying skip-build-cache and skip-pkg-cache.

Of course, the first time there is no cache, so everything works fine.

2022-01-13T04:40:11.2965429Z Requested golangci-lint 'latest', using 'v1.43.0', calculation took 118ms
2022-01-13T04:40:11.2966576Z Installing golangci-lint v1.43.0...
...
2022-01-13T04:40:12.4949233Z Cache Size: ~153 MB (160100096 B)
2022-01-13T04:40:12.4974487Z [command]/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/51388359-0acc-450c-89a5-fd48615b296c/cache.tzst -P -C /home/runner/work/mywork/mywork
2022-01-13T04:40:13.1883899Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/util_test.go: Cannot open: File exists
2022-01-13T04:40:13.1894488Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/viper_go1_15.go: Cannot open: File exists
2022-01-13T04:40:13.1895338Z /usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/.gitignore: Cannot open: File exists
2022-01-13T04:40:13.1895930Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/viper_go1_16.go: Cannot open: File exists
2022-01-13T04:40:13.1896876Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/internal/testutil/filepath.go: Cannot open: File exists
2022-01-13T04:40:13.1897722Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/internal/testutil/env_go1_16.go: Cannot open: File exists
2022-01-13T04:40:13.1898515Z ##[error]/usr/bin/tar: ../../../go/pkg/mod/github.com/spf13/[email protected]/internal/testutil/env_go1_17.go: Cannot open: File exists
...

Our workflow settings:

- name: lint
  uses: golangci/golangci-lint-action@v2
  with:
    version: latest

ishikawa avatar Jan 13 '22 05:01 ishikawa

Same issue for me

joaocostamm avatar May 11 '22 09:05 joaocostamm

Could you please use the latest version that we released yesterday? One issue with caching was resolved.

- name: lint
  uses: golangci/golangci-lint-action@v3
  with:
    version: latest

SVilgelm avatar May 11 '22 17:05 SVilgelm

@SVilgelm, didn't help me.

vtopc avatar Jun 27 '22 21:06 vtopc

may be related to https://github.com/golangci/golangci-lint-action/issues/496

we're using v3 there

FelipeLema avatar Jul 08 '22 19:07 FelipeLema

I'm seeing something similar, as in that we don't get annotations

Run golangci/golangci-lint-action@v3
  with:
    only-new-issues: true
    github-token: ***
    skip-cache: false
    skip-pkg-cache: false
    skip-build-cache: false
prepare environment
  Finding needed golangci-lint version...
  Requested golangci-lint 'latest', using 'v1.50.1', calculation took 49ms
  Installing golangci-lint v1.50.1...
  Downloading https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-amd64.tar.gz ...
  Writing patch to /tmp/tmp-1761-sR1sB5fiDf7Y/pull.patch
  /usr/bin/tar xz --overwrite --warning=no-unknown-keyword --overwrite -C /home/runner -f /home/runner/work/_temp/ac93a03b-fe62-4287-8058-968380a24a6f
  Installed golangci-lint into /home/runner/golangci-lint-1.50.1-linux-amd64/golangci-lint in 941ms
  Received 171966464 of 241788661 (71.1%), 163.5 MBs/sec
  Received 241788661 of 241788661 (100.0%), 155.6 MBs/sec
  Cache Size: ~231 MB (241788661 B)
  /usr/bin/tar --use-compress-program unzstd -xf /home/runner/work/_temp/9e869f5e-85bf-4926-9dee-756b9697889d/cache.tzst -P -C /home/runner/work/kubernetes-ingress/kubernetes-ingress
...
  Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/[email protected]/stackoverflow/stackoverflow.go: Cannot open: File exists
  Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/[email protected]/vk/vk.go: Cannot open: File exists
  Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/[email protected]/oauth2.go: Cannot open: File exists
  Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/[email protected]/fitbit/fitbit.go: Cannot open: File exists
  /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/[email protected]/CONTRIBUTING.md: Cannot open: File exists
  /usr/bin/tar: Exiting with failure status due to previous errors
  Warning: Failed to restore: Tar failed with error: The process '/usr/bin/tar' failed with exit code 2
  Cache not found for input keys: golangci-lint.cache-2758-0bc2bb025ceba06555192588e80c455eb31482c8, golangci-lint.cache-2758-
  Prepared env in 6239ms

but at the end it says Cache not found 🤔

lucacome avatar Nov 17 '22 01:11 lucacome

Interesting that this isn't fixed yet, I'm simply copying the workflow file recommended to use in the README and the annotations are not being created.

I can workaround this issue by setting both: skip-pkg-cache and skip-build-cache to true.

bschaatsbergen avatar Dec 05 '23 00:12 bschaatsbergen

Duplicate of #135

ldez avatar May 04 '24 16:05 ldez