Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing packages in a local directory

What is the best practice to install packages (those with go get...) in a local directory?

Example: I'd like to try out the Revel web framework, but I don't want to clutter my go installation at /usr/local/go.

Normally I'd say sudo go get github.com/robfig/revel as written on the home page, but that would install it beneath /usr/local/go/src/pkg/....

Is there an easy way to say (for example) go get --local ... and have the package in the current (sub) directory?

like image 316
topskip Avatar asked Sep 20 '12 13:09

topskip


1 Answers

To expand on keks answer, you can update your .bashrc to look like this

export GOROOT=/usr/local/go
export GOPATH=~/workspace/me/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Now all packages installed with go get are separate from the go distribution.

like image 76
dskinner Avatar answered Sep 28 '22 19:09

dskinner