File tree 1 file changed +21
-6
lines changed 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,30 @@ runs:
23
23
cache : false
24
24
go-version : ${{ inputs.version }}
25
25
26
- - name : Cache go
26
+ - name : Get cache dirs
27
+ id : get_cache_dirs
28
+ shell : bash
29
+ run : |
30
+ echo "::set-output name=go-mod-cache::$(go env GOMODCACHE)"
31
+ echo "::set-output name=go-cache::$(go env GOCACHE)"
32
+ # We split up GOMODCACHE from GOCACHE because the latter must be invalidated
33
+ # on code change, but the former can be kept.
34
+ - name : Cache $GOMODCACHE
35
+ uses : buildjet/cache@v3
36
+ with :
37
+ path : |
38
+ ${{ steps.get_cache_dirs.outputs.go-mod-cache }}}
39
+ key : gomodcache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
40
+ restore-keys : |
41
+ gomodcache-${{ runner.os }}-${{ github.job }}-
42
+ gomodcache-${{ runner.os }}-
43
+ gomodcache-
44
+
45
+ - name : Cache $GOCACHE
27
46
uses : buildjet/cache@v3
28
47
with :
29
- # ~/go/pkg is the same across operating systems.
30
48
path : |
31
- ~/go/pkg
32
- ~/.cache/go-build
33
- ~/AppData/Local/go-build
34
- ~/Library/Caches/go-build
49
+ ${{ steps.get_cache_dirs.outputs.go-cache }}}
35
50
# Job name must be included in the key for effective
36
51
# test cache reuse.
37
52
key : gocache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
You can’t perform that action at this time.
0 commit comments