Skip to content

adding go.mod file reference to actions/setup-go#563

Merged
kp2099 merged 2 commits intomainfrom
karthik/fix/workflows/action-setup-go
Sep 19, 2025
Merged

adding go.mod file reference to actions/setup-go#563
kp2099 merged 2 commits intomainfrom
karthik/fix/workflows/action-setup-go

Conversation

@kp2099
Copy link
Copy Markdown
Contributor

@kp2099 kp2099 commented Sep 19, 2025

Currently, actions/setup-go is not aligned with the Go version specified in the project, which causes the notify-integration-release step to use a different Go version. This mismatch leads to make generate failing and prevents documentation from being published to the developer website.

This change updates actions/setup-go to automatically read the Go version from the project's go.mod file, ensuring consistency and preventing build failures.

I have tested this change locally using act, and i have attached screenshots for the same

Screenshot 2025-09-19 at 1 51 50 PM Screenshot 2025-09-19 at 1 59 27 PM Screenshot 2025-09-19 at 1 52 23 PM

@kp2099 kp2099 requested a review from a team as a code owner September 19, 2025 08:31
@tanmay-hc
Copy link
Copy Markdown
Contributor

@kp2099 This change should work but can we make it more in sync with other github actions we have?
They use the following method

outputs:
      go-version: ${{ steps.get-go-version.outputs.go-version }}
    steps:
      - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
      - name: 'Determine Go version'
        id: get-go-version
        # We use .go-version as our source of truth for current Go
        # version, because "goenv" can react to it automatically.
        run: |
          echo "Building with Go $(cat .go-version)"
          echo "go-version=$(cat .go-version)" >>"$GITHUB_OUTPUT"

Declare the go-version in a step, like we do it for packer-versionin the notify action, and use it.
Thought?

@tenthirtyam
Copy link
Copy Markdown
Collaborator

Wouldn't go.mod be more accurate since that's essentially the source of truth?

@kp2099
Copy link
Copy Markdown
Contributor Author

kp2099 commented Sep 19, 2025

@kp2099 This change should work but can we make it more in sync with other github actions we have? They use the following method

outputs:
      go-version: ${{ steps.get-go-version.outputs.go-version }}
    steps:
      - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
      - name: 'Determine Go version'
        id: get-go-version
        # We use .go-version as our source of truth for current Go
        # version, because "goenv" can react to it automatically.
        run: |
          echo "Building with Go $(cat .go-version)"
          echo "go-version=$(cat .go-version)" >>"$GITHUB_OUTPUT"

Declare the go-version in a step, like we do it for packer-versionin the notify action, and use it. Thought?

I’m not sure why the extra step was added initially, but actions/setup-go already supports using a .go-version file as the source for the Go version.

Since go.mod and .go-version should ideally be in sync, we can simply point setup-go to the .go-version file:

      - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
        with:
          go-version-file: '.go-version'

With this approach, there’s no need for a separate step just to read the Go version, the setup action handles it automatically.

I have tested it locally and here is a ref comment as well. And as @tenthirtyam pointed out go.mod should be the actual source of truth in my opinion

Copy link
Copy Markdown

@mukulmohan177 mukulmohan177 left a comment

Choose a reason for hiding this comment

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

LGTM

@kp2099 kp2099 merged commit 8b1f6a6 into main Sep 19, 2025
14 checks passed
@kp2099 kp2099 deleted the karthik/fix/workflows/action-setup-go branch September 19, 2025 11:11
@github-actions
Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants