setup-go/dist/cache-save
maxcleme 49fe0b8fcc
fix: allow multiple invocations with caching enabled
This fix addresses the issue where calling setup-go multiple times with
caching enabled in the same workflow would fail because the second
invocation attempted to save to the same cache key.

Changes:
- Add tracking of processed cache keys using state variables to prevent
  duplicate cache save attempts
- Add helper functions in constants.ts for state management:
  - getAlreadyCachedKey()/setAlreadyCachedKey(): Track keys already in cache
  - getPrimaryCacheKey()/setPrimaryCacheKey(): Track the primary key for
    each invocation
  - getCachedGoModPath()/setCachedGoModPath(): Track which go.mod was cached
- Modify cache-restore.ts to store state about the cache operation
- Modify cache-save.ts to check if cache was already saved for this
  go.mod path before attempting to save again
- Add comprehensive tests for the multiple invocation scenario

This enables workflows that need to setup Go with different configurations
(e.g., different working directories) multiple times without cache
conflicts.

Assisted-By: cagent
2026-03-03 18:14:01 +01:00
..
index.js fix: allow multiple invocations with caching enabled 2026-03-03 18:14:01 +01:00