Skip to content

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

Open
@ccoVeille

Description

@ccoVeille

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions