Skip to content

Using .tool-versions as go-version-file does not work #680

@hanseartic

Description

@hanseartic

Description:
When using the action with

  with
    go-version-file: .tool-versions

it fails because the file is not being parsed correctly.

Action version:
v6.0.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted (only checked ubuntu-arm)

Tools version:
golang 1.25.3 (works when using go.mod)

Repro steps:

  • Add a .tool-versions file to your go project:

    golang 1.25.3
    nodejs v22.21.1
    
    

    Or just add the golang directive – will fail as well.

  • Make the workflow use this file:

    on:
      push:
        branches: [ '**' ]
    jobs:
      use_tool_versions:
        env:
          GOARCH: arm64
          GOOS: linux
        runs-on: ubuntu-24.04-arm
        permissions:
          contents: read
        steps:
          - uses: actions/checkout@v5
            with:
              fetch-depth: 0
          - name: Setup Go
            uses: actions/setup-go@v6
            with:
              go-version-file: .tool-versions
              cache-dependency-path: go.sum
          - name: Verify Go installation
            run: |
              go version
              echo "golang installed successfully from .tool-versions file"
    
  • Trigger a run of the workflow

Expected behavior:
golang version from .tool-versions file (1.25.3) will be selected and installed.

Actual behavior:
The file seems to not be parsed correctly:

Run actions/setup-go@v6
  with:
    go-version-file: .tool-versions
    cache-dependency-path: go.sum
    check-latest: false
    token: ***
    cache: true
  env:
     <SHORTENED FOR READABILITY>
Setup go version spec golang 1.25.3
nodejs v22.21.1
Attempting to download golang 1.25.3
nodejs v22.21.1...
matching golang 1.25.3
nodejs v22.21.1...
Not found in manifest.  Falling back to download directly from Go
Error: Unable to find Go version 'golang 1.25.3
nodejs v22.21.1' for platform linux and architecture arm64.

Here is the link to an example run: https://github.com/hanseartic/setup-go-fails-with-tool-versions/actions/runs/19139275557
The same happens on self-hosted (which I can't share in a public repo).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions