Use actions/setup-go@v3 with caching support (#41)

This commit is contained in:
Pieter Noordhuis 2022-09-08 11:21:00 +02:00 committed by GitHub
parent 2e12a2aa01
commit d214f44df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 18 deletions

View File

@ -20,21 +20,10 @@ jobs:
run: git fetch --prune --unshallow run: git fetch --prune --unshallow
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v1 uses: actions/setup-go@v3
with: with:
go-version: 1.18.x go-version: 1.18.x
cache: true
- name: Cache packages
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
/opt/hostedtoolcache/go
vendor
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set go env - name: Set go env
run: | run: |
@ -53,12 +42,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-go@v1 - name: Setup Go
uses: actions/setup-go@v3
with: with:
go-version: 1.18.x go-version: 1.18.x
# No need to download cached dependencies when running gofmt.
cache: false
- name: Run gofmt - name: Run gofmt
run: | run: |
# -l: list files that were reformatted # -l: list files that were reformatted

View File

@ -12,9 +12,10 @@ jobs:
- name: Unshallow - name: Unshallow
run: git fetch --prune --unshallow run: git fetch --prune --unshallow
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.18 go-version: 1.18
cache: true
- name: Import GPG key - name: Import GPG key
id: import_gpg id: import_gpg
uses: hashicorp/ghaction-import-gpg@v2.1.0 uses: hashicorp/ghaction-import-gpg@v2.1.0