> current directory is. But if the current directory happens to be > inside a module, the user inadvertently also performed (1).
Thanks, Mihai. That sounds like a consistent explanation. I'm going to try creating a new junk project to see if I can reproduce the problem. Unfortunately, I'm going to be traveling for the next 2 days and won't have time to try it until Sunday. For the time being I've simply done a git checkout to retrieve the prior go.mod and go.sum. On Thu, Sep 5, 2019 at 3:53 PM Mihai Borobocea <mihaibopub...@gmail.com> wrote: > On Thu, Sep 5, 2019 at 10:18 PM Jan Mercl <0xj...@gmail.com> wrote: > > `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`. > > A-ha, I think I understand the problem: 'go get' can be used for two > unrelated purposes: > 1) to add/update dependencies in the current Go module > 2) to install a program globally: 'go get golang.org/x/lint/golint' > produces ~/go/bin/golint > > One normally wants to perform (2) from anywhere: like 'apt-get install > ...' (or perhaps 'npm install -g ...'), it doesn't matter what the > current directory is. But if the current directory happens to be > inside a module, the user inadvertently also performed (1). > > If this is the case, it seems an issue worth addressing. > However, I have only a basic understanding of go commands and modules. > I might miss important details. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/golang-nuts/-vUHGd5zlPI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAMXRBmi_Gpa9_DrmDXP8NKNP7YR2xi-ZSxuRGKcdqHbidZytcQ%40mail.gmail.com > . > -- 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 https://groups.google.com/d/msgid/golang-nuts/CAK6kDbYFGF4JVqJKZL1XzWw3MEzM7t5O_BLY2a6jStwJh%2BtZDQ%40mail.gmail.com.