Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
/ setup-go-with-cache Public archive

๐Ÿš€ Setup a Go environment, additionally enable the module & build caching

License

Notifications You must be signed in to change notification settings

gacts/setup-go-with-cache

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Logo

Setup Go environment with a Cache

Release version Build Status License

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.

Support

Issues Issues

If you find any action errors - please, make an issue in the current repository.

License

This is open-sourced software licensed under the MIT License.