Skip to content

Commit 1472cce

Browse files
authored
chore: increment GOCACHE key (#8849)
1 parent 6b69970 commit 1472cce

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

.github/actions/setup-go/action.yaml

+11-10
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,25 @@ runs:
3939
path: |
4040
${{ env.GOMODCACHE }}
4141
key: gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}
42-
restore-keys: |
43-
gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-
44-
gomodcache-${{ runner.os }}-
42+
# restore-keys aren't used because it causes the cache to grow
43+
# infinitely. go.sum changes very infrequently, so rebuilding from
44+
# scratch every now and then isn't terrible.
4545

4646
- name: Cache $GOCACHE
4747
uses: buildjet/cache@v3
4848
with:
4949
path: |
5050
${{ env.GOCACHE }}
51-
# Job name must be included in the key for effective
52-
# test cache reuse.
51+
# Job name must be included in the key for effective test cache reuse.
5352
# The key format is intentionally different than GOMODCACHE, because any
54-
# time a Go file changes we invalidate this cache, whereas GOMODCACHE
55-
# is only invalidated when go.sum changes.
56-
key: gocache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
53+
# time a Go file changes we invalidate this cache, whereas GOMODCACHE is
54+
# only invalidated when go.sum changes.
55+
# The number in the key is incremented when the cache gets too large,
56+
# since this technically grows without bound.
57+
key: gocache2-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
5758
restore-keys: |
58-
gocache-${{ runner.os }}-${{ github.job }}-
59-
gocache-${{ runner.os }}-
59+
gocache2-${{ runner.os }}-${{ github.job }}-
60+
gocache2-${{ runner.os }}-
6061
6162
- name: Install gotestsum
6263
shell: bash

0 commit comments

Comments
 (0)