Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow using go-version and go-version-file at same time in certain conditions #547

Open
ccoVeille opened this issue Jan 30, 2025 · 1 comment
Labels
feature request New feature or request to improve the current logic

Comments

@ccoVeille
Copy link

ccoVeille commented Jan 30, 2025

Description:

go-version already accepts stable and oldstable aliases, they are great.

go-version-file was also a great addition, but these options cannot be used at same time.

As the documentation explains it clearly

If both the go-version and the go-version-file inputs are provided then the go-version input is used.

Justification:

Take a look at this PR

monzo/typhon#178

The version 1.19 had be hardcoded, while it was the one in the go.mod

go-version-file could have been used,
but you cannot use it with go-version

I wish this could have been used

name: Run Tests
on:
  - pull_request
jobs:
  test:
    strategy:
      matrix:
        go-version: ["go-version-file", "1.23.x"]
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go-version }}
        go-version-file: "go.mod"

the current behavior is unchanged unless the "go-version" is set to "go-version-file".

So when go-version equals 1.xx, stable or anything else than go-version-file, the go-version is used. And go-version-file node is ignored

But when go-version is set to go-version-file, go-version-file node is used.

may there is already a way to do it ? 🤔 I didn't check, but maybe it's already working by using 🤔
name: Run Tests
on:
  - pull_request
jobs:
  test:
    strategy:
      matrix:
        go-version: ["", "1.23.x"]
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go-version }}
        go-version-file: "go.mod"

But adding the alias "go-version-file" in go-version would make things clearer.

Also, maybe if accepted it could help with:

This could also provides a solution for:

EDIT, I found out the #450 after opening my issue, so I'm quoting it here. I can close my issue and comment in #450 if you prefer.

Are you willing to submit a PR?

Not yet, I'm opening the discussion for now.

@ccoVeille ccoVeille added feature request New feature or request to improve the current logic needs triage labels Jan 30, 2025
@ccoVeille ccoVeille changed the title Allow to use go-version and go-version-file at same time Allow using go-version and go-version-file at same time in certain conditions Jan 30, 2025
@mahabaleshwars
Copy link

mahabaleshwars commented Jan 31, 2025

Hi @ccoVeille,
Thank you for creating this feature request. We will investigate it and provide feedback as soon as we have some updates.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

2 participants