-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add $GOPATH/bin to $PATH #14
Comments
GOBIN would be a better choice I think for this |
|
I think this should probably be resolved together with #12. Given my most recent comment in that issue, are you ok with closing here and following up there? |
I think you're overthinking this. The official Go docker images simply hard-code Why not do the same? If anyone wants to set up a custom |
As stated in this issue, you can't run tools installed using go get without first updating $PATH. actions/setup-go#14 Also add -set_exit_status to make golint return 1 if any issues are found. https://github.com/golang/lint/blob/master/golint/golint.go#L24
You can avoid this issue by instead using the actions |
@leighmcculloch I assume that won't work for testing on mac and windows, though, so fixing this bug is still very useful. |
I prefer this solution below. This works on windows, ubuntu, and mac.
|
Although Github Actions provides a Go action, that action doesn't set up the environment for use with Go. actions/setup-go#14 suggests that this is broken-as-intended. The two workarounds suggested there are using the Go container image to run tests; or to explicitly set up the environment like this.
@sanemat that still doesn't look right, as there is a bug in the checkout for that To get it to work, I had to hardcode my path - which is unacceptable to me in a github action as things should be evaluated per ENVs and template vars:
Notice the
Not what the
To make matters worse, you cannot access this above directory as there is no ENV var that sets it to be consumed. So it has to be hardcoded! |
hopefully we can get to this soon as part of v2-beta. |
relates to actions/setup-go#14
relates to actions/setup-go#14
So, the devs on the checkout action told me there was a newer version @v2 that fixes the This worked for all of my other actions, and I can remove the hardcoded
I'm happy with this for now, as it's now abstracted and I can copy it across all of my repos with no hardcoding of the repo itself. However, it still seems very verbose: having to set the GOPATH and BIN in other actions, as well as specifying BASH everywhere so I can pickup that GOPATH. |
I completely agree with @eduncan911, also because of this issue I have to run |
|
I'm working on this today. Sorry for the delay, I've been busy :) I'm adding it to the v2-beta as v1 is sealed and new features are going into the v2 line. |
I added this feature to the v2-beta. If some folks here can validate, I can take out of beta. Here's it is being used and as you can see in "path" step, it's being added to the path now: https://github.com/bryanmacfarlane/actions-playground/runs/537349478?check_suite_focus=true |
@bryanmacfarlane works on all my repos that were using #41, thanks for implementing this! 🎉 Some examples:
|
@fsouza - awesome. Note that you can also use setup-go@v2-beta and I'll make it v2 soon. |
Closing since solution is verified. If anyone has any issues trying it out with @v2-beta let me know and I'll look into it. |
@bryanmacfarlane
https://github.com/arvenil/kata/runs/609649648?check_suite_focus=true |
try this
- name: Check code quality
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u github.com/mgechev/revive
revive -config .revive.toml -formatter friendly -exclude vendor/... $(go
list ./...)
|
Nevermind. I got it working. The issues is that package is being put outside of GOPATH by setup-go. So I tried to
|
@arvenil does your |
@ydnar Yes |
@arvenil to fix this, either:
We had this problem and ended up doing (2). |
- setup-go v2 fixes actions/setup-go#14
I know it's just simple common sense to you but to me... you're a freakin' GENIUS! 💎✨👍 It makes so much fucking sense to me now! |
When installing tools via
go get
(e.g. golint) they can not be ran without adding$GOPATH/bin
to$PATH
beforehand.So for using e.g. golint one would need to write a step:
It would be cool, if setup-go could already do the
export PATH=$PATH:$(go env GOPATH)/bin
part, as this is a common need.The text was updated successfully, but these errors were encountered: