Cannot run go install on Ubuntu

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 GOBIN

However 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 it

export GOPATH=/dir1:/dir2:/dir3

If GOBIN is not set, binaries from /dir1/src end up in /dir1/bin, binaries from /dir2/src end up in /dir2/bin, and so on (and binaries from $GOROOT/src end up in $GOROOT/bin).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like