I set my GOPATH to
/Users/me/dev/go
and I have
/Users/me/dev/go/src/client1 /Users/me/dev/go/src/client2 /Users/me/dev/go/src/client3
and also
/Users/me/dev/client1/rails_project /Users/me/dev/client2/php_project etc.
I don't like how in my root dev folder I'm forced to have this general "go" dir that holds many different client's go projects.
Yes, GOPATH
is a list of directories (like PATH
). Run go help gopath
for details. For example, on Linux, I have:
$ go env GOROOT="/home/peter/go" GOPATH="/home/peter/gopath:/home/peter/public/gopath" $
I have something similar on Windows.
Note: Linux uses :
as the GOPATH
list separator; Windows uses ;
as the separator.
If you use go get
it will default to the first directory in the list.
Run go env
to check that everything is correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With