Skip to content

Fix GitHub Actions Go cache error by adding cache-dependency-path#7

Merged
TanNhatCMS merged 3 commits intodevfrom
copilot/fix-68e4f524-b8fe-4cee-ac8e-8b9962d0fbfe
Nov 22, 2025
Merged

Fix GitHub Actions Go cache error by adding cache-dependency-path#7
TanNhatCMS merged 3 commits intodevfrom
copilot/fix-68e4f524-b8fe-4cee-ac8e-8b9962d0fbfe

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 2, 2025

Problem

GitHub Actions workflows were failing with the following error during the "Setup Go" step:

Setup Go (stable)
Restore cache failed: Dependencies file is not found in /home/runner/work/FlyEnv/FlyEnv. Supported file pattern: go.sum

Root Cause

The actions/setup-go@v5 action was looking for go.sum in the repository root directory (/home/runner/work/FlyEnv/FlyEnv), but the actual Go module is located in the src/helper-go/ subdirectory. Without specifying the correct path, the action couldn't find the dependencies file needed for caching.

Solution

  1. Generated go.sum file: Created the missing go.sum file by running go mod tidy in the src/helper-go/ directory. This file contains checksums for all Go dependencies.

  2. Added cache-dependency-path parameter: Updated all GitHub Actions workflow files that use actions/setup-go to include the cache-dependency-path: src/helper-go/go.sum parameter, which tells the action where to find the Go dependencies file.

Changes

Updated the following workflow files:

  • .github/workflows/build-linux.yml
  • .github/workflows/build-macos.yml
  • .github/workflows/build-windows.yml
  • .github/workflows/linux-version-build.yml
  • .github/workflows/release-build.yml

Each workflow now correctly specifies the Go module location:

- name: Setup Go (stable)
  uses: actions/setup-go@v5
  with:
    go-version: 'stable'
    cache-dependency-path: src/helper-go/go.sum

This fix ensures that:

  • ✅ Go dependency caching works correctly
  • ✅ Build times are improved through proper cache usage
  • ✅ The error message no longer appears in workflow runs
  • ✅ All workflows are consistent in their Go setup configuration

Fixes https://github.com/TanNhatCMS/FlyEnv/actions/runs/18184706233/job/51766761920#annotation:4:24

Original prompt

https://github.com/TanNhatCMS/FlyEnv/actions/runs/18184706233/job/51766761920#annotation:4:24
Setup Go (stable)
Restore cache failed: Dependencies file is not found in /home/runner/work/FlyEnv/FlyEnv. Supported file pattern: go.sum
fix lỗi trên


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 2, 2025 06:15
Co-authored-by: TanNhatCMS <113796420+TanNhatCMS@users.noreply.github.com>
Co-authored-by: TanNhatCMS <113796420+TanNhatCMS@users.noreply.github.com>
Copilot AI changed the title [WIP] https://github.com/TanNhatCMS/FlyEnv/actions/runs/18184706233/job/51766761920#annotation:4:24 Setup Go (stable) Restore cache failed: Dependencies file is not found in /home/runner/work/FlyEnv/FlyEnv. Supported file pattern: go.sum fix lỗi trên Fix GitHub Actions Go cache error by adding cache-dependency-path Oct 2, 2025
Copilot AI requested a review from TanNhatCMS October 2, 2025 06:19
@TanNhatCMS TanNhatCMS marked this pull request as ready for review November 22, 2025 15:03
@TanNhatCMS TanNhatCMS merged commit de1dd50 into dev Nov 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants