Search code examples
goraspbian

What's the proper way to install a go package to the system path?


I'm trying to install a go project (the keybase client, in particular), but I want to install it globally for all the users on my system.

I've searched around and found a few people who accidentally install things to /usr/local/go/bin or something to that effect, but no instructions on how I actually should be installing things to such locations.

But that's what I want to do - globally install the application. How should I be doing that with go?

I'm not using any of the pre-built packages because none exist for Raspbian Jesse.


Solution

  • The approach that I've taken is this:

    PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/go/ go get github.com/keybase/client/go/keybase
    PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/go/ go install -tags production github.com/keybase/client/go/keybase
    

    Which ends out installing keybase to /usr/local/go/bin/keybase. It's possible that there's a better way, but so far I haven't seen one.