setup-go: compile: version "go1.16.2" does not match go tool version "go1.15.8"

Failed case: https://github.com/fatedier/release-test/runs/2121758524?check_suite_focus=true

- name: Set up Go
  uses: actions/setup-go@v2
  with:
    go-version: '1.16.2'

Workflow file: https://github.com/fatedier/release-test/actions/runs/657671091/workflow

I’m not sure why there are go1.15.8 version.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 9
  • Comments: 17 (5 by maintainers)

Commits related to this issue

Most upvoted comments

this issue can be duct-taped like:

      run: |
        export PATH=${GOROOT}/bin:$PATH
        go version

issue I found is that GOROOT is appended at the end of the path, basically it will resolve system go in /usr/bin first if not fixed

this issue can be duct-taped like:

      run: |
        export PATH=${GOROOT}/bin:$PATH
        go version

issue I found is that GOROOT is appended at the end of the path, basically it will resolve system go in /usr/bin first if not fixed

Noticed that I see this issue while using act, i could not reproduce it on the Github.

Hi @fatedier, could you try to remove go symlink from /usr/bin as workaround in your workflow file?

- run: sudo rm /usr/bin/go

@Sergey-Murtazin Thanks for your reply.

Maybe remove export PATH := $(GOPATH)/bin:$(PATH) could work for this Makefile since it not rely on $(GOPATH)/bin.

However, i need to execute make e2e to run e2e tests in my real project. It will download ginkgo first by go install github.com/onsi/ginkgo/ginkgo@latest and then execute it from $GOPATH/bin. It works well in most of environments.

Can we set GOPATH variable in setup-go action, so users will not be affect by different environments?

Ok so I managed to solve it by specifying go to use in the build process when using https://github.com/open-telemetry/opentelemetry-collector-builder

--go string                The Go binary to use during the compilation phase (default "/usr/bin/go")

The problem is that /usr/bin/go has a different version than what is installed via the action (unless you specify the very same version to use ofc).