Skip to content

Commit 4ad10bf

Browse files
committed
chore: update Go module cache paths in CI workflow
Replaces dynamic cache path detection with static paths for Go build and module cache. Also updates cache key to include Go version and improves restore-keys for better cache hits.
1 parent ade937e commit 4ad10bf

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,16 @@ jobs:
4242
with:
4343
go-version: ${{ matrix.go-version }}
4444

45-
# Get values for cache paths to be used in later steps
46-
- id: cache-paths
47-
run: |
48-
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
49-
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
5045
- name: Cache go modules
5146
uses: actions/cache@v4
5247
with:
5348
path: |
54-
${{ steps.cache-paths.outputs.go-cache }}
55-
${{ steps.cache-paths.outputs.go-mod-cache }}
56-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
57-
restore-keys: ${{ runner.os }}-go-
49+
~/.cache/go-build
50+
~/go/pkg/mod
51+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
52+
restore-keys: |
53+
${{ runner.os }}-go-${{ matrix.go-version }}-
54+
${{ runner.os }}-go-
5855
5956
- name: Run go test
6057
run: go test ./... -coverprofile=coverage.out -covermode=atomic

0 commit comments

Comments
 (0)