actions / setup-go

Set up your GitHub Actions workflow with a specific version of Go
MIT License
1.41k stars 531 forks source link

Extend `go-version` to accept go.mod files #489

Open myaaaaaaaaa opened 4 months ago

myaaaaaaaaa commented 4 months ago

Description: Right now, matrix testing ['go.mod', 'stable'] is somewhat awkward since it involves deliberately setting go-version to an empty string:

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go-version: ['', 'stable']

    steps:
    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go-version }}
        go-version-file: go.mod

This PR makes such a matrix test more straightforward:

 jobs:
   tests:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        go-version: ['', 'stable']
+        go-version: ['go.mod', 'stable']

     steps:
     - name: Setup Go
       uses: actions/setup-go@v5
       with:
         go-version: ${{ matrix.go-version }}
-        go-version-file: go.mod

Related issue: Fixes #450

Check list:

myaaaaaaaaa commented 3 months ago

Friendly ping