setup-go/__tests__
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
..
data Add comprehensive breaking changes documentation for v6 (#674) 2025-11-19 09:40:16 -06:00
cache-restore.test.ts fix: allow multiple invocations with caching enabled 2026-03-03 18:14:01 +01:00
cache-save.test.ts fix: allow multiple invocations with caching enabled 2026-03-03 18:14:01 +01:00
cache-utils.test.ts Update default Go module caching to use go.mod (#705) 2026-01-26 10:59:03 -06:00
setup-go.test.ts Add support for .tool-versions file in setup-go, update workflow (#673) 2025-10-28 10:26:52 -05:00
utils.test.ts Update self-hosted environment validation and bump undici version (#556) 2025-04-01 10:32:30 -05:00
verify-go.sh Use GitHub releases to download Go versions. (#58) 2020-06-29 11:41:13 -04:00
windows-toolcache.test.ts Fix Install on Windows is very slow (#393) 2023-08-03 14:33:56 +02:00