Skip to content

Commit 6bee848

Browse files
committed
chore: Add Windows image version to cache key
1 parent fb61fd6 commit 6bee848

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ runs:
2323
echo "GOMODCACHE=D:\\golang\\modcache" >> $GITHUB_ENV
2424
echo "GOPATH=D:\\golang\\go" >> $GITHUB_ENV
2525
echo "USERPROFILE=D:\\homedir" >> $GITHUB_ENV
26+
echo "OS_EXTRA_VERSION=${ImageVersion}-v2-" >> $GITHUB_ENV
2627
elif [ "$RUNNER_OS" = "macOS" ]; then
2728
echo "GOCACHE=/Users/runner/go/pkg/mod" >> $GITHUB_ENV
2829
echo "GOMODCACHE=/Users/runner/Library/Caches/go-build" >> $GITHUB_ENV
@@ -36,18 +37,18 @@ runs:
3637
path: |
3738
${{ env.GOCACHE }}
3839
${{ env.GOMODCACHE }}
39-
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
40+
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
4041
restore-keys: |
41-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
42+
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
4243
- uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a
4344
if: ${{ inputs.upload-cache != 'true' }}
4445
with:
4546
path: |
4647
${{ env.GOCACHE }}
4748
${{ env.GOMODCACHE }}
48-
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
49+
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
4950
restore-keys: |
50-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
51+
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
5152
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
5253
with:
5354
cache: false

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ jobs:
360360
go-version: ${{ env.GO_VERSION }}
361361
- name: build
362362
run: |
363-
go build -v ./...
363+
go build -v -x ./...
364364
- name: run
365365
run: |
366366
go run . --version

0 commit comments

Comments
 (0)