On Wed, 2018-08-08 at 11:50 +0200, Jan Mercl wrote:
> On Mon, Aug 6, 2018 at 6:12 AM Kevin Locke <ke...@kevinlocke.name> wrote:
>> Is there a way to update packages installed using `go get` without
>> duplicating packages that are distributed with Go or by my Linux
>> distribution?
> 
> Assuming your $GOPATH is something like
> <distro-provided-packages>:<locally-installed-packages>
> 
> $ cd <locally-installed-packages>/src; go get -u ./...

In my initial email $GOPATH was unset.

If I set distro-provided-packages first on $GOPATH, then `go get`
fails with the following:

$ export GOPATH="/usr/share/go:$HOME/go"
$ rm -rf ~/go
$ go get -u mvdan.cc/sh/cmd/shfmt
package mvdan.cc/sh/cmd/shfmt: cannot download, /usr/share/go is a GOROOT, not 
a GOPATH. For more details see: 'go help gopath'

(Note: I don't have any golang-* Debian packages installed except
golang-1.10*, golang-go, golang-src, so the only distro-provided
packages are the ones that ship with the go runtime.  The
/usr/share/gocode directory used by Debian for third-party Go packages
does not exist.)

If I set distro-provided-packages second on $GOPATH, then the same
behavior as my initial email occurs:

$ export GOPATH="$HOME/go:/usr/share/go"
$ rm -rf ~/go
$ go get -u mvdan.cc/sh/cmd/shfmt
$ cd ~/go/src
$ go list ./... | wc -l
6
$ go get -u ./...
$ go list ./... | wc -l
98

Thanks for the suggestion!  Let me know if you have any other ideas to
try.

Kevin

-- 
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