When I run the go install command for my custom packages on Ubuntu 14.04 I got this error:
go install: no install location for .go files listed on command line (GOBIN not set)How can i set $GOBIN relative in my projects directory in [anyproject]/bin?
1 Answer
In go, there is a directory with all binaries rather than one bin directory per project.
So let's say you want all your go binaries to be in $HOME/go/bin. Then run
mkdir $HOME/go/bin
GOBIN=$HOME/go/bin; export GOBINHowever you don't need to set GOBIN if the GOROOT environment variable is set up properly. So I suggest using the instructions given in
Also see where Russ Cox informs:
If GOBIN is set, that's where binaries end up. If GOBIN is not set, then the binaries end up in a directory named 'bin' under the root of the tree where the source code lives. For things in $GOROOT, that means
$GOROOT/bin. For things in in a GOPATH directory DIR, that means DIR/bin. Note that GOPATH can have multiple directories in itexport GOPATH=/dir1:/dir2:/dir3If GOBIN is not set, binaries from
/dir1/srcend up in/dir1/bin, binaries from/dir2/srcend up in/dir2/bin, and so on (and binaries from$GOROOT/srcend up in$GOROOT/bin).