On Thu, Sep 5, 2019 at 8:51 PM Mihai Borobocea <
mihaib...@gmail.com> wrote:
> $ 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.
Thanks for the pointer. I think that behavior is not a good idea. Yes,
it's convenient that when working on a module and realizing some
dependency is missing, `go get` handles updating `go.mod`. However at
the same time this breaks the workflow of possibly a big number of
people. The OP's :GoUpdateBinaries in vim-go is just one example. I
don't know how many people use `vim_go`, but the project has 10k+
stars. Developer's scripts/make files/go generate "scripts" etc, all
of that may legitimately invoke `go get` for things the module _is
not_ actually dependent on.
`go get` should do just one thing and do it well. Automagically
adjusting `go.mod` if one is found in the current directory (or in any
of its parents) when outside $GOPATH is IMO neither of that. Or it
should be enabled by a flag, like -um (update go.mod) or this is maybe
a job for some `go mod foo` command, not `go get`.