Caution
Since actions/setup-go
now supports caching and restoring go modules and build outputs, this action is no longer
necessary. Please use actions/setup-go
directly.
To migrate, simply replace uses: gacts/setup-go-with-cache@v1
with uses: actions/setup-go@v5
(or later) in
your workflow file. Read more
details here.
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.22
- 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.22}}
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.