Closed linglingye001 closed 2 months ago
With go version 1.22.6
, the cache restored successfully. I’m not sure if this is related to the Go version. Thanks
Hello @linglingye001 👋, Thank you for reporting this. We will investigate the issue and get back to you as soon as we have updates.
I got a similar problem and I also see that even if the cache is marked as found by the action many packages are still downloaded :( I'm not sure the cache is working properly by default
I also had a similar issue with V5 , go version 1.23 . Here are some logs (debug mode):
...
2024-08-27T12:10:00.9630701Z ../../../../.cache/go-build/54/
2024-08-27T12:10:00.9631864Z Cache Size: ~0 MB (58214 B)
2024-08-27T12:10:00.9635096Z [command]/usr/bin/tar -xf /home/runner/actions-runner/_work/_temp/47ac88a3-544a-4172-8835-ebd0ed8b2ffd/cache.tzst -P -C /home/runner/actions-runner/_work/<repository_name>/<repository_name> --use-compress-program unzstd
2024-08-27T12:10:00.9637846Z /usr/bin/tar: ../../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/doc.go: Cannot open: File exists
2024-08-27T12:10:00.9639625Z /usr/bin/tar: ../../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/LICENSE: Cannot open: File exists
2024-08-27T12:10:00.9641358Z /usr/bin/tar: ../../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/config.json: Cannot open: File exists
2024-08-27T12:10:00.9643051Z /usr/bin/tar: ../../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/go.mod: Cannot open: File exists
2024-08-27T12:10:00.9644483Z /usr/bin/tar: Exiting with failure status due to previous errors
2024-08-27T12:10:00.9672705Z ##[warning]Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
2024-08-27T12:10:00.9680769Z Cache is not found
2024-08-27T12:10:00.9693251Z ##[add-matcher]/home/runner/actions-runner/_work/_actions/actions/setup-go/v5/matchers.json
2024-08-27T12:10:00.9704908Z ##[debug]Added matchers: 'go'. Problem matchers scan action output for known warning or error strings and report these inline.
2024-08-27T12:10:00.9706337Z go version go1.23.0 linux/amd64
The configuration i used is:
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: go.sum
It seems we are having the same issue. The only way to make builds pass is to delete the cache manually and restart the job.
Hi @linglingye001, We've upgraded go and golangci-lint to the latest versions (Go: 1.23, golangci-lint: v1.60.3) and Successfully executed the workflow without encountering any errors. Here's a screenshot for your reference. To help us further investigate the issue, Could you please attach link to the build or public repository to reproduce the issue ?
I observed the warning
Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
in a job run in https://github.com/ayoisaiah/f2, 4 days ago. But now it disappeared in runs since 2 days ago.
4 days ago, warning raised https://github.com/ayoisaiah/f2/actions/runs/10655048967/job/29532111772#step:3:47 Extra log lines compared to the 2-day later job run:
Cache Size: ~150 MB (157614651 B)
/usr/bin/tar -xf /home/runner/work/_temp/01f44140-0d43-465c-a6d0-4c19986b2b4e/cache.tzst -P -C /home/runner/work/f2/f2 --use-compress-program unzstd
Received 157614651 of 157614651 (100.0%), 150.2 MBs/sec
/usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/doc.go: Cannot open: File exists
/usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/LICENSE: Cannot open: File exists
/usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/config.json: Cannot open: File exists
/usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/go.mod: Cannot open: File exists
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
[...]
go env
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1403091904=/tmp/go-build -gno-record-gcc-switches'
The no-warning job run was 1 commit ahead, which updates go dependencies, see https://github.com/ayoisaiah/f2/compare/5865461f50db4c15345c93a1d3458308f22972da...560fe309926b3d476428eb926889e5c4c24dc4d6.
I'm also facing this issue with Go 1.23.
And my errors also point to go/pkg/mod/golang.org/x/telemetry/config
(by the way, is it the new telemetry feature introduced since go 1.23?)
Then, I tried cache: false
and use @actions/cache
directly:
- uses: actions/setup-go@v5
with:
go-version: '1.23.0'
cache: false
- name: Get Go ENVs
id: go_envs
shell: bash
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
key: v1-go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
v1-go-${{ runner.os }}-
path: |
${{ steps.go_envs.outputs.GOMODCACHE }}
${{ steps.go_envs.outputs.GOCACHE }}
It failed similarly:
Then I tried cleaning modcache
before calling (restoring) @actions/cache
:
- uses: actions/setup-go@v5
with:
go-version: '1.23.0'
cache: false
- name: Get Go ENVs
id: go_envs
shell: bash
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
- shell: bash
run: |
go clean -modcache
- uses: actions/cache@v4
with:
key: v1-go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
v1-go-${{ runner.os }}-
path: |
${{ steps.go_envs.outputs.GOMODCACHE }}
${{ steps.go_envs.outputs.GOCACHE }}
It also failed:
Then I tried using rm -rf
instead of go clean
and, interestingly, it threw permission denied:
I could sudo rm -rf
instead, but then it still failed when restoring cache:
sudo chmod -R 0777
also failed:
However, cleaning both -modcache
and -cache
somehow worked:
which is weird to me because the error is pointing to GOMODCACHE (go/pkg/mod
).
Edit: I ran my workflow another time and this time it failed :crying_cat_face: (even when cleaning both -modcache
and -cache
):
p/s I would like to note that this issue happens when restoring cache, while @gowridurgad ran a workflow that had no cache yet.
Hi @muzimuzhi, @datbth, The issue you're facing during cache restoration is due to the telemetry update in Go 1.23.0. This update includes files (config.json, go.mod, LICENSE, doc.go) that already exist in the golang.org/x/telemetry directory, causing conflicts. When restoring the cache, these existing files prevent the tar command from completing successfully, resulting in "File exists" errors.
We have observed that the error related to extracting telemetry files is not present in Go version 1.23.1. Attached a screenshot for your reference This suggests that the issue might have been resolved in the newer release. We recommend updating your workflow to use Go version 1.23.1 as follows:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.1
If you continue to experience issues, please let us know.
I just tried a few workflows with 1.23.1 and it is working fine so far.
Still find it quite weird that removing the whole modcache directory did not work.
But anyway, I'm good for now. Thank you!
Hi @linglingye001, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.
Hi @gowridurgad , it works with version 1.23.1, thanks!
Hi @linglingye001, Thank you for the confirmation. We are proceeding to close this issue as it has been resolved. If any future clarifications are needed, please feel free to reach out.
Description: We have upgraded the go version of our project to
1.23
and updated the golangci-lint as well. But the log outputCache not found
which made golangci-lint fail.Action version: Specify the action version
setup-go@v5
Platform: Ubuntu
Runner type: Hosted
Tools version:
1.23.0