-
Notifications
You must be signed in to change notification settings - Fork 613
Description
Description:
When the version of Go in the go directive of go.mod is different from the version in the toolchain directive there is a cache conflict which causes errors on cache extraction.
Note: I think this is related to, but different from #403 since that appears to be covering the situation where some other tool is also working on the cache, but this issue is purely for the action running on a hosted runner without any additional changes to the environment etc.
Action version:
actions/setup-go@v4
Platform:
- UbuntumacOS (untested)Windows (untested)To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Runner type:
- HostedSelf-hostedTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Tools version:
go 1.21.0toolchain go1.21.1
Repro steps:
See repo https://github.com/matthewhughes-uw/setup-go-test/, very basic repo with a single workflow that just runs this action (https://github.com/matthewhughes-uw/setup-go-test/blob/main/.github/workflows/go.yaml):
First run of the action https://github.com/matthewhughes-uw/setup-go-test/actions/runs/6195831453/job/16821285537
- Installs Go 1.21.0 (version detected from
go-version-file - Go detects toolchain and performs a toolchain install of Go 1.21.1 (see output
go: downloading go1.21.1 (linux/amd64)) - This places some files under
../../../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.1.linux-amd64 - Finds no existing cache, doesn't try to extract anything
- Caches
/home/runner/go/pkg/mod(which contains the files above) and/home/runner/.cache/go-build
Second run of the action https://github.com/matthewhughes-uw/setup-go-test/actions/runs/6195844389/job/16821321968
- First two steps as above
- Finds an existing cache, attempts to extract it, but because of the toolchain installation step files under
../../../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.1.linux-amd64are already present on the machine, causing errors fromtar
Expected behavior:
Caching of the toolchain is handled gracefully, no errors between runs that don't contain any extra caching logic outside of what the action provides by default
Actual behavior:
Errors on cache extraction (see repro steps)
Activity
[-]Tar errors on cache restore with differing go and toolchain directives[/-][+]Tar errors on cache restore after toolchain installation[/+]dsame commentedon Sep 15, 2023
Hello @matthewhughes-uw , thank you for the input. We are starting to investigate the problem.
thall commentedon Jan 8, 2024
do you have any updates around this to share?
33 remaining items
matthewhughes-uw commentedon Apr 14, 2025
Per my comment above (#424 (comment)) I think the solution here is to avoid Go toolchain installs (since these are what cause the duplicate files), see also:
Update go tests to use the version file instead of a hardcoded version
Configure environment to avoid toolchain installs
Removed commented out toolchain directives - to workaround actions/se…
Pipeline efficiency (#108)
aparnajyothi-y commentedon Oct 8, 2025
Hello Everyone, This issue has been addressed through improvements in #460. The problem no longer reproduces in the latest v6 release. Please update to the latest version, and reopen if the issue persists. Thank you
Update setup-go action to v6.0.0
Update setup-go action to v6.0.0
Update setup-go action to v6.0.0 (#615)