+
Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 10, 2025

This PR updates all GitHub Actions workflows to use the Go version specified in the go.mod file instead of maintaining a separate GO_VERSION environment variable.

Changes

All workflow files now use go-version-file: 'go.mod' for the actions/setup-go@v6 action:

- name: Set up Go
  uses: actions/setup-go@v6
  with:
    go-version-file: 'go.mod'

Previously, workflows used a GO_VERSION environment variable:

env:
  GO_VERSION: '1.25.0'

# ...

- name: Set up Go
  uses: actions/setup-go@v6
  with:
    go-version: ${{ env.GO_VERSION }}

The GO_VERSION environment variable has been removed from all workflow files, making go.mod the single source of truth for the Go toolchain version.

Benefits

  • Single source of truth: The Go version is now maintained in only one place (go.mod)
  • Automatic synchronization: All workflows automatically use the version specified in go.mod
  • Reduced maintenance: Updating the Go version only requires changing go.mod, not every workflow file
  • Follows best practices: Uses GitHub Actions' built-in support for reading Go versions from go.mod

Affected Workflows

  • .github/workflows/main.yml (8 setup-go steps)
  • .github/workflows/pr.yml (8 setup-go steps)
  • .github/workflows/release.yml (1 setup-go step)
  • .github/workflows/scan.yml (1 setup-go step)
  • .github/workflows/vulncheck.yml (1 setup-go step)

All workflows have been verified to build and test successfully using Go 1.25.2 as specified in go.mod.

Original prompt

use go.mod file for go version in workflows

Right now the setup-go action in the workflows in this repo is set up like this:

uses: actions/setup-go@v6
with:
  go-version: ${{ env.GO_VERSION }}

I want to change this to

uses: actions/setup-go@v6
with:
  go-version-file: 'go.mod'

Remove the GO_VERSION env var from every workflow file that uses it. When you're done, the only place where the go toolchain version is specified must be the go.mod file.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI assigned Copilot and dhth Oct 10, 2025
@Copilot Copilot AI changed the title [WIP] Use go.mod file for Go version in workflows Use go.mod file for Go version in workflows Oct 10, 2025
@Copilot Copilot AI requested a review from dhth October 10, 2025 23:37
Copilot finished work on behalf of dhth October 10, 2025 23:37
@dhth dhth closed this Oct 10, 2025
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.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载