actions / setup-go

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

PATH setting doesn't seem to be working anymore. #490

Closed digitalghost-dev closed 4 months ago

digitalghost-dev commented 4 months ago

Description: I am using v5 of this action and the $PATH doesn't seem to be getting set. I have CLI tool that I am building and in one of my tests, I mimic running the CLI tool. Locally, I use go install then run go test ./... and since my $PATH is set, it can find the program.

For example, I have this code snippet in a test file that runs the program and some arguments:

    for _, test := range tests {
        cmd := exec.Command("poke-cli", test.args...)
        var out bytes.Buffer
        cmd.Stdout = &out
        cmd.Stderr = &out

This action used to work just fine as you can see here in previous attempts, but now, it is failing and I am not sure what happened. It first failed in this Pull Request but I didn't touch the go_test.yml file.

Here is the whole go_test.yml file:

name: Test

on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  tests:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.21

      - name: Install dependencies
        run: |
          go get .

      - name: Run tests
        run: go test -v ./...

Action version: v5

Platform:

Runner type:

Tools version: Go: 1.21

Repro steps:
Here is a Pull Request where I am trying to run this Action and it's failing: https://github.com/digitalghost-dev/poke-cli/pull/19

Expected behavior: $PATH is set when using this action.

Actual behavior: Getting an error that the binary can't be found in $PATH:

cli_test.go:63: Unexpected error: exec: "poke-cli": executable file not found in $PATH
digitalghost-dev commented 4 months ago

I replaced go get . with go install .