This sort of "global" get/install is being discussed in
https://github.com/golang/go/issues/24250 (which will also cover the
documentation point). It's marked as "release blocked" for Go 1.12.

For now, I think the best approach is to:

GO111MODULE=off go get -u github.com/my/package

i.e. drop back to GOPATH-mode. You can optionally set GOBIN as you
suggest, but not necessary because GOPATH will default to $HOME/go


Paul
On Mon, 10 Sep 2018 at 09:41, Caleb Spare <cesp...@gmail.com> wrote:
>
> What's the best substitute for "go get my/tool" in a modules world?
>
> I used to be able to tell my users to set up Go with a GOPATH workspace and 
> then run "go get -u github.com/my/package". I can't find an equivalent 
> workflow now. The closest I can find is
>
> GOBIN=~/bin GO111MODULES=on go get github.com/my/package@latest
>
> But this drops go.mod/go.sum files in the current directory, which I don't 
> want. Is there some command to just build and put a binary in a directory 
> without touching any other files (outside the cache)?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to