Reputation: 2630
I have two folders for GOPATH:
export GOPATH=$HOME/Work:$HOME/HomeWork
Here is their structure organization:
Work
/pkg
/src
/github.com
HomeWork
/pkg
/src
/github.com
By default
$ go get github.com/gin-gonic/gin
will put the repository in the first GOPATH.
Now I want to install a github repository to a specific GOPATH, for example in:
HomeWork
/pkg
/src
/github.com
/gin-gonic
How can I achieve that?
Upvotes: 0
Views: 1267
Reputation: 11541
According to Go Wiki:
https://github.com/golang/go/wiki/GOPATH
Use a single GOPATH
Even though the GOPATH may be a list of directories, it is generally correct and sufficient to use a single GOPATH for all Go code on your machine. Since all packages retrieved with "go get" have a unique URL (and thus a unique path on disk), having more than one GOPATH is almost never necessary when building with the Go tool.
Upvotes: 8
Reputation: 2971
Well I can't see an option to do this in go get --help
.
But you could use this *nix way to achieve it:
$ GOPATH=$HOME/HomeWork go get github.com/gin-gonic/gin
And your original GOPATH
won't be changed by above command.
Upvotes: 7