~/src/go-statsd-client> echo $GOPATH /Users/me/gopath ~/src/go-statsd-client> echo $GOROOT /usr/local/Cellar/go/1.1.1\ ~/src/go-statsd-client> go install go install: no install location for directory /Users/me/src/go-statsd-client outside GOPATH
When you provide no arguments to
go install, it defaults to attempting to install the package in the current directory. The error message is telling you that it cannot do that, because the current directory isn’t part of your
You can either:
$GOPATHto your $HOME (
- Move your source to within the current
mv ~/src/go-statsd-client /User/me/gopath).
After either, going into the
go-statsd-client directory and typing
go install will work, and so will typing
go install go-statsd-client from anywhere in the filesystem. The built binaries will go into
As an unrelated suggestion, you probably want to namespace your package with a domain name, to avoid name clashing (e.g.
github.com/you/go-statsd-client, if that’s where you hold your source code).