Add $GOPATH/bin to $PATH
See original GitHub issueWhen 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:
- run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint -set_exit_status ./...
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:84
- Comments:25 (6 by maintainers)
Top Results From Across the Web
How do I SET the GOPATH environment variable on Ubuntu ...
Just add the following lines to ~/.bashrc and this will persist. ... export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin.
Read more >How to Write Go Code (with GOPATH)
For convenience, add the workspace's bin subdirectory to your PATH : $ export PATH=$PATH:$(go env GOPATH)/bin. The scripts in the rest of this...
Read more >Setup | GopherSource
Understand your GOPATH. The GOPATH is the location where Go looks for source code, caches packages, etc. · Add GOPATH/bin to your PATH....
Read more >Installing Go - Play with Go
Add the install target to your profile PATH : $ echo export PATH="/usr/local/go/bin:$PATH" >>$HOME/.profile. Source your profile to test the new settings:
Read more >Go Path Explained - Medium
In Short The GOPATH is an environment variable that helps Go to look for go source code. go env GOPATH · Can be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think you’re overthinking this. The official Go docker images simply hard-code
PATH
, as you can see here: https://github.com/docker-library/golang/blob/3a6407a6ff134ef6a0364ac061b0808f990ea14e/1.13-rc/alpine3.10/Dockerfile#L59-L60Why not do the same? If anyone wants to set up a custom
GOPATH
orGOBIN
, they can set up a customPATH
too. I’d preferPATH
to be simple and predictable.I prefer this solution below. This works on windows, ubuntu, and mac.
https://stackoverflow.com/a/59242962/104080