Skip to content

Use actions/setup-go with caching for go install#64

Merged
jeffwidman merged 1 commit intomainfrom
setup-go-with-caching
Mar 9, 2026
Merged

Use actions/setup-go with caching for go install#64
jeffwidman merged 1 commit intomainfrom
setup-go-with-caching

Conversation

@jeffwidman
Copy link
Copy Markdown
Member

@jeffwidman jeffwidman commented Mar 9, 2026

What

Replace the manual Add Go bin to PATH step with actions/setup-go, which handles PATH setup automatically and caches the Go build/module cache across runs.

Why

The go install step in the smoke workflow takes ~23s. actions/setup-go caches the Go build and module cache by default (since v4, cache: true is the default so it doesn't need to be specified), so subsequent runs where the CLI version hasn't changed should be near-instant.

Also uses go-version-file: go.mod to match the project's Go version, consistent with ci.yml.

Changes

  • Replaced Add Go bin to PATH shell step with actions/setup-go@v6.2.0
  • Set go-version-file: go.mod (caching is enabled by default)

Copilot AI review requested due to automatic review settings March 9, 2026 20:35
@jeffwidman jeffwidman force-pushed the setup-go-with-caching branch from 79d756e to 0e3f799 Compare March 9, 2026 20:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the smoke.yml workflow to replace the manual Add Go bin to PATH shell step with the actions/setup-go action, enabling automatic Go PATH setup and cross-run caching of the Go build and module cache via cache: true. The approach matches the existing pattern already used in ci.yml.

Changes:

  • Replaced Add Go bin to PATH (manual echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH") with actions/setup-go@v6.2.0
  • Added go-version-file: go.mod to use the project's declared Go version, consistent with ci.yml
  • Enabled cache: true to cache the Go build/module cache across runs

Replace the manual 'Add Go bin to PATH' step with actions/setup-go,
which handles PATH setup automatically and caches the Go build/module
cache across runs (cache is enabled by default since v4, so no need to
specify cache: true). Uses go-version-file to match the project's go.mod.
- name: Install Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version-file: go.mod
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, I didn't know you could do that.

@jeffwidman jeffwidman merged commit f4b7f05 into main Mar 9, 2026
92 of 264 checks passed
@jeffwidman jeffwidman deleted the setup-go-with-caching branch March 9, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants