Hi everyone, Posting this here to get some general feedback before consuming anyone's time with a proposal on Github.
The current behavior in the Go tooling is to infer the module name when running "go mod init" (without a name) inside of $GOPATH/src/github.com/username/repo. Here is an example: $ cd $GOPATH/src/github.com/joncalhoun/demo $ go mod init # This creates a go.mod file # go.mod file generated module github.com/joncalhoun/demo go 1.16 I am proposing that the tooling be updated to also infer this from version control if present. Using git as an example: # not in $GOPATH $ git remote -v origin g...@github.com:joncalhoun/demo.git (fetch) origin g...@github.com:joncalhoun/demo.git (push) go mod init # This creates a go.mod file derived from origin # go.mod file generated module github.com/joncalhoun/demo go 1.16 There are probably some edge cases to consider, like multiple VCS being present. In any ambiguous case I propose we stick to the default behavior of an error message. The need for this is pretty minor - it saves me a handful of keystrokes at best - so I understand if it doesn't seem worth the effort. It feels close enough to the current behavior to be a good addition, but I admittedly haven't explored how easy/hard it would be to implement. Best, Jon -- 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/83833bc0-3e8a-4c42-b523-2d4e222d2b06n%40googlegroups.com.