@@ -39,24 +39,25 @@ runs:
39
39
path : |
40
40
${{ env.GOMODCACHE }}
41
41
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.
45
45
46
46
- name : Cache $GOCACHE
47
47
uses : buildjet/cache@v3
48
48
with :
49
49
path : |
50
50
${{ 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.
53
52
# 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.**') }}
57
58
restore-keys : |
58
- gocache -${{ runner.os }}-${{ github.job }}-
59
- gocache -${{ runner.os }}-
59
+ gocache2 -${{ runner.os }}-${{ github.job }}-
60
+ gocache2 -${{ runner.os }}-
60
61
61
62
- name : Install gotestsum
62
63
shell : bash
0 commit comments