Skip to content
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

Utilize the .tool-versions file to set expected Go version #402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dsame
Copy link
Contributor

@dsame dsame commented Jul 27, 2023

Description:

Add '.tool-versions' to 'go.mod' and 'go.work' as a source of the go version

Related issue:
link to the related issue.

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@dsame dsame requested a review from a team as a code owner July 27, 2023 17:37
@dsame dsame linked an issue Jul 27, 2023 that may be closed by this pull request
@troian
Copy link

troian commented Aug 10, 2023

isn't it already implemented in go1.21's go.mod as toolchain option?

@dsame
Copy link
Contributor Author

dsame commented Aug 16, 2023

the merging is blocked by #375 (comment)

@dsame
Copy link
Contributor Author

dsame commented Aug 16, 2023

Hello @troian

isn't it already implemented in go1.21's go.mod as toolchain option?

i don't think so, because we still have to use the action with the versions prior 1.21 and toolchain option is different in the mean it can call out for different go versions used for build/test/lint tasks. But thank you for pointing out this new feature - it should be incorporated into the action. It would be good to create the feature request .

Copy link

@Kleigh1003 Kleigh1003 left a comment

Choose a reason for hiding this comment

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

Fetch text 8439997576

@TastyPi
Copy link

TastyPi commented Aug 29, 2024

@dsame is this still planned? It's been nearly a year since the last update.

For everyone like me who found this PR while trying to get actions/setup-go working with .tool-versions, here's the solution we've settled on:

steps:
  - uses: actions/checkout@v4
  - id: go-version
    run: echo "go-version=$(cat .tool-versions | grep golang | cut -d ' ' -f 2)" >> "$GITHUB_OUTPUT"
  - uses: actions/setup-go@v5
    with:
      go-version: ${{ steps.go-version.outputs.go-version }}

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.

feat: Utilize the.tool-versions file to set expected Go version
6 participants