On Thu, Sep 5, 2019 at 9:22 PM Jan Mercl <0xj...@gmail.com> wrote:
> > Running 'go get ...' inside a module can add indirect dependencies to 
> > go.mod.
> I'm surprised. There's probably some rationale behind `go get` having
> such side effects. Can anyone please shed some light on this?

$ go help module-get
The 'go get' command changes behavior depending on whether the
go command is running in module-aware mode or legacy GOPATH mode.
Get resolves and adds dependencies to the current development module
and then builds and installs them.

If you are inside a module (there is a go.mod file in your current dir
or a parent dir) you can just type
$ go help get
But the output of this command changes depending on your current dir
(describes either module-aware or legacy GOPATH behavior).

Other resources are https://tip.golang.org/doc/go1.13#modules (with a
subsection on go get), https://github.com/golang/go/wiki/Modules and
this series of blog posts https://blog.golang.org/using-go-modules
These are what I've looked at to get a sense of modules and stop using
GOPATH now that go 1.13 is out.

I posted this related message with a minimal example of module
dependencies and thoughts/questions on how to update my module's
direct dependencies without mentioning indirect dependencies:

My impression is that Go modules and dependency management are well
thought through and the commands have well defined behavior. But it is
not a small topic/scenario, so getting a sense of how things work
takes some effort and experimentation.


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.
To view this discussion on the web visit 

Reply via email to