Coder Social home page Coder Social logo

Comments (12)

kjk avatar kjk commented on August 20, 2024 84

I agree this should work by default but for now you can add to each step:

export PATH=${PATH}:`go env GOPATH`/bin

See https://presstige.io/p/Using-GitHub-Actions-with-Go-2ca9744b531f4f21bdae9976d1ccbb58#e86c1c15-6f43-4f43-935f-37895bd14208 for a fuller example (I use that for running staticcheck)

(just a tip, I'm not the maintainer).

from setup-go.

davidgraca avatar davidgraca commented on August 20, 2024 13

Hi everyone, ressurecting the dead here...
Let's start by the beggining, you:

  • put that on your gh action

- name: Setup Go environment uses: actions/[email protected]

  • go check go env

GOPATH="/home/runner/go"

  • go check $PATH

$PATH: /home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

  • and see that all your go installs are on GOPATH /bin

I added to my action:
export PATH=${PATH}:go env GOPATH/bin

and now it works fine.
Would it be possible to refix this?
Thanks

from setup-go.

bryanmacfarlane avatar bryanmacfarlane commented on August 20, 2024 2

actually after further investigation it looks like the env and path are already getting set, but to the wrong values.

Agreed. Will fix.

from setup-go.

JeremyLoy avatar JeremyLoy commented on August 20, 2024 1

In addition to that @devigned I think the ‘GOPATH’ statement two lines above that needs an ‘else’

from setup-go.

ARolek avatar ARolek commented on August 20, 2024 1

I just hit this problem and upgrading to v2-beta fixed this problem for me.

from setup-go.

bryanmacfarlane avatar bryanmacfarlane commented on August 20, 2024 1

Awesome to hear. I’ll probably release v2 Monday

from setup-go.

JeremyLoy avatar JeremyLoy commented on August 20, 2024

actually after further investigation it looks like the env and path are already getting set, but to the wrong values.

Below are some screenshots of the MacOS setup. go env is correctly saying that GOPATH is User/runner/go. This means that GOBIN will default to User/runner/go/bin since it is unset.

If we look at PATH, it seems that /usr/local/go/bin is getting set. By my understanding, this is not the correct value for any operating system, definitely not macOS.

image

image

from setup-go.

devigned avatar devigned commented on August 20, 2024

setup-go/src/installer.ts

Lines 119 to 121 in 75259a5

if (goBin) {
core.exportVariable('GOBIN', goBin);
}

Should have an else and export the default GOBIN into the path and set the PATH to include the GOBIN.

from setup-go.

devigned avatar devigned commented on August 20, 2024

Agreed. If nothing is overridden, Golang defaults should be honored.

from setup-go.

lmittmann avatar lmittmann commented on August 20, 2024

Duplicate of #14

from setup-go.

bryanmacfarlane avatar bryanmacfarlane commented on August 20, 2024

This should be fixed in @v2-beta version of this action. See #14

from setup-go.

ARolek avatar ARolek commented on August 20, 2024

Nice! Thanks for putting this action together. I have been using it with a few projects.

from setup-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.