-
Notifications
You must be signed in to change notification settings - Fork 626
Document how to use Go version file as a fallback for Go matrix builds #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Document how to use Go version file as a fallback for Go matrix builds #693
Conversation
This strategy is useful for projects that want to specify a default Go version for their CI builds, while still allowing overrides through the Go matrix to target the latest Go versions.
There was a problem hiding this 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 documents the ability to use an empty string for go-version to enable fallback to go-version-file, addressing a commonly misunderstood feature. This is particularly useful for matrix builds where some jobs should use specific Go versions (like stable and oldstable) while others should use the version defined in the project's go.mod file.
- Added empty string syntax documentation to the supported version syntax table
- Added a new section demonstrating matrix testing with go-version-file fallback
- Provides a practical example showing how to combine explicit versions with file-based version specification
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| go-version: ['stable', 'oldstable', ''] # empty string to fall back on go-version-file |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment capitalization is inconsistent with the documentation style. Looking at the "Complete Input Reference" section (lines 365-384), comments are written in sentence case without periods (e.g., "Version or version range of Go to use", "Path to go.mod..."). This comment should be revised to match that style, for example: "Empty string falls back to go-version-file".
| go-version: ['stable', 'oldstable', ''] # empty string to fall back on go-version-file | |
| go-version: ['stable', 'oldstable', ''] # Empty string falls back to go-version-file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not, I'll wait for a human feedback here
| - uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| go-version-file: "go.mod" # this one is only used when go-version is not specified. |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment capitalization and style is inconsistent with the documentation. Looking at the "Complete Input Reference" section (lines 365-384), comments are written in sentence case without periods and lowercase for field names. This should be revised to match, for example: "Used only when go-version is not specified" or "Fallback when go-version is not specified".
| go-version-file: "go.mod" # this one is only used when go-version is not specified. | |
| go-version-file: "go.mod" # used only when go-version is not specified |
Description:
This strategy is useful for projects that want to specify a default Go version for their CI builds, while still allowing overrides through the Go matrix to target the latest Go versions.
The fact
go-versionsetting can be left empty is often misunderstood.Related issue:
Check list: