Skip to content

Update default Go module caching to use go.mod#705

Merged
HarithaVattikuti merged 3 commits intoactions:mainfrom
priyagupta108:cache-gomod
Jan 26, 2026
Merged

Update default Go module caching to use go.mod#705
HarithaVattikuti merged 3 commits intoactions:mainfrom
priyagupta108:cache-gomod

Conversation

@priyagupta108
Copy link
Contributor

@priyagupta108 priyagupta108 commented Jan 12, 2026

Description:
This pull request updates the default Go module caching strategy in the action to use go.mod as the cache key.

Related issue:
#478

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@priyagupta108 priyagupta108 requested a review from a team as a code owner January 12, 2026 09:17
Copilot AI review requested due to automatic review settings January 12, 2026 09:17
@priyagupta108 priyagupta108 self-assigned this Jan 12, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the default Go module caching strategy to use go.mod instead of go.sum as the cache key dependency file. This change aligns with the V6 release strategy for intelligent caching that incorporates toolchain directives from go.mod.

Changes:

  • Updated default dependency file pattern from go.sum to go.mod in package manager configuration
  • Renamed variables in cache-restore logic from goSumFileExists to goModFileExists for clarity
  • Updated action.yml description to clarify support for both go.mod and go.sum
  • Added comprehensive test coverage for the new default behavior
  • Updated documentation to explain the change and how to use go.sum if needed

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/package-managers.ts Changed default dependencyFilePattern from 'go.sum' to 'go.mod'
src/cache-restore.ts Updated variable names from goSumFileExists to goModFileExists for consistency
action.yml Updated cache-dependency-path description to clarify it accepts both go.mod and go.sum
tests/cache-utils.test.ts Updated test expectations to use 'go.mod' as dependency file pattern
tests/cache-restore.test.ts Refactored existing tests and added new test for go.mod default behavior
dist/setup/index.js Compiled distribution file reflecting source changes
dist/cache-save/index.js Compiled distribution file reflecting source changes
README.md Added documentation explaining the new default and how to override it
package-lock.json Updated qs dependency from 6.14.0 to 6.14.1 (routine update)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@priyagupta108 priyagupta108 linked an issue Jan 13, 2026 that may be closed by this pull request
Updated breaking changes section with enhanced formatting and clarified toolchain management details.
@HarithaVattikuti HarithaVattikuti merged commit a5f9b05 into actions:main Jan 26, 2026
112 checks passed
MissingRoberto added a commit to grafana/grafana that referenced this pull request Mar 11, 2026
Update the reusable setup-go action to use **/*.mod instead of **/*.sum
for cache-dependency-path.

go.sum is an append-only checksum log that only grows and never removes
entries, making it a poor cache key — it causes unnecessary cache misses
when entries are added but dependencies haven't actually changed. go.mod
accurately represents the actual dependency graph and is the correct
file for cache invalidation.

This aligns with the upstream actions/setup-go v6 default change:
actions/setup-go#705

Made-with: Cursor
MissingRoberto added a commit to grafana/grafana that referenced this pull request Mar 11, 2026
Update the reusable setup-go action to use **/*.mod instead of **/*.sum
for cache-dependency-path.

go.sum is an append-only checksum log that only grows and never removes
entries, making it a poor cache key — it causes unnecessary cache misses
when entries are added but dependencies haven't actually changed. go.mod
accurately represents the actual dependency graph and is the correct
file for cache invalidation.

This aligns with the upstream actions/setup-go v6 default change:
actions/setup-go#705

Made-with: Cursor
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.

Caching should use go.mod, not go.sum

6 participants