Composite GitHub Action which combines the perfect pairing of actions/setup-go with actions/cache for the caching of both the Golang module and build caches (the original action idea was taken here).
Reducing all these workflow steps:
steps:
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
Down to this:
steps:
- uses: gacts/setup-go-with-cache@v1
with: {go-version: 1.19}
Or using go-version-file
for version selection:
steps:
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}
Tip: Use Dependabot to maintain your
gacts/setup-go-with-cache
version updated in your GitHub workflows.
If you find any action errors - please, make an issue in the current repository.
This is open-sourced software licensed under the MIT License.