Skip to content

Specifying go-version does not ignore go.mod if the current directory contains go.mod file. #679

@cerik-nguyen

Description

@cerik-nguyen

Description:
When running setup-go, we usually do the following:

jobs:
  foo:
    runs-on:
      - bar
    steps:
      - name: "Checkout Actions"
        uses: actions/checkout@v5
      - name: "Setup Go"
        uses: actions/setup-go@v5
        with:
          go-version: '1.23'
          cache: false
....

Expected behavior:
The latest go1.23 version to be downloaded and the job is done.
However, setup-go@v5's implementation will not respect this and tries to install the version specified from the toolchain directive in go.mod, if the checked out repository contains a go.mod file, which seems unintended.

For reference, I tried using v6 and got the expected behavior.

Are you willing to submit a PR?
Sorry, I'm quite busy at work!

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