cmd/go: `go get` creates go.mod and go.sum files inconsistently, depending on directory #30248
What version of Go are you using (
changed the title
cmd/go: inconsistent behavior when use `go get` to install a gomod binary with GO111MODULE on in different directories
Feb 15, 2019
I think this is expected behavior for the go command running in modules mode. The go command documentation for module downloading and verification describes this - namely that it creates a go.mod and go.sum in the main module's root directory, and will be updated/created when a new dependency is installed. I don't think it has anything to do with being in a git repository specifically, but being in a directory that contains go code.
This also may be a more appropriate question to post at https://golang.org/wiki/Questions.
/cc @bcmills to correct me or add extra context.