Skip to content

Fail to cache with go version 1.23  #498

Closed

Description

@linglingye001

Description:
We have upgraded the go version of our project to 1.23 and updated the golangci-lint as well. But the log output Cache not found which made golangci-lint fail.

Setup go version spec 1.23.0
Attempting to download 1.23.0...
matching 1.23.0...
Acquiring 1.23.0 from https://github.com/actions/go-versions/releases/download/1.23.0-103[8](https://github.com/Azure/AppConfiguration-KubernetesProvider/actions/runs/10519320181/job/29146495024#step:3:9)0775229/go-1.23.0-linux-x64.tar.gz
Extracting Go...
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/bf173660-517d-4d7[9](https://github.com/Azure/AppConfiguration-KubernetesProvider/actions/runs/10519320181/job/29146495024#step:3:10)-8823-26a5e905efc1 -f /home/runner/work/_temp/c8[11](https://github.com/Azure/AppConfiguration-KubernetesProvider/actions/runs/10519320181/job/29146495024#step:3:12)b549-7eec-4ea2-8c26-73b4bee40ebc
Successfully extracted go to /home/runner/work/_temp/bf173660-517d-4d79-8823-26a5e905efc1
Adding to the cache ...
Successfully cached go to /opt/hostedtoolcache/go/1.23.0/x64
Added go to the path
Successfully set up Go version 1.23.0
/opt/hostedtoolcache/go/1.23.0/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.23.0/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Cache is not found
go version go1.23.0 linux/amd64

Action version:
Specify the action version
setup-go@v5

Platform:
Ubuntu

Runner type:
Hosted

Tools version:

1.23.0

Activity

  1. linglingye001 commented on Aug 23, 2024

    @linglingye001
    Author

    With go version 1.22.6, the cache restored successfully. I’m not sure if this is related to the Go version. Thanks

  2. v-priya-kinthali commented on Aug 23, 2024

    @v-priya-kinthali
    Contributor

    Hello @linglingye001 👋,
    Thank you for reporting this. We will investigate the issue and get back to you as soon as we have updates.

  3. remyleone commented on Aug 26, 2024

    @remyleone

    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

  4. andreigorgan commented on Aug 27, 2024

    @andreigorgan

    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
    
  5. galdor commented on Sep 3, 2024

    @galdor

    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.

  6. v-gowridurgad commented on Sep 5, 2024

    @v-gowridurgad

    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 ?

    Screenshot 2024-09-04 at 5 19 49 PM
  7. muzimuzhi commented on Sep 5, 2024

    @muzimuzhi

    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'
      
    • 2 days ago, no warnings.
      https://github.com/ayoisaiah/f2/actions/runs/10655117355/job/29532260567#step:3:39

    The no-warning job run was 1 commit ahead, which updates go dependencies, see ayoisaiah/f2@5865461...560fe30.

  8. datbth commented on Sep 7, 2024

    @datbth

    I'm also facing this issue with Go 1.23.
    And my errors also point to go/pkg/mod/golang.org/x/telemetry/config
    image
    (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:
    image

    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:
    image

    Then I tried using rm -rf instead of go clean and, interestingly, it threw permission denied:
    image

    I could sudo rm -rf instead, but then it still failed when restoring cache:
    image

    sudo chmod -R 0777 also failed:
    image

    However, cleaning both -modcache and -cache somehow worked:
    image

    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 😿 (even when cleaning both -modcache and -cache):
    image

    p/s I would like to note that this issue happens when restoring cache, while @gowridurgad ran a workflow that had no cache yet.

  9. v-gowridurgad commented on Sep 11, 2024

    @v-gowridurgad

    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.

    Screenshot 2024-09-10 at 4 46 11 PM
  10. datbth commented on Sep 11, 2024

    @datbth

    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!

  11. v-gowridurgad commented on Sep 16, 2024

    @v-gowridurgad

    Hi @linglingye001, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.

  12. linglingye001 commented on Sep 18, 2024

    @linglingye001
    Author

    Hi @gowridurgad , it works with version 1.23.1, thanks!

  13. v-gowridurgad commented on Sep 18, 2024

    @v-gowridurgad

    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.

  14. added a commit that references this issue on Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions