/ go Public
cmd/go: replace use of "main module" in help docs & error messages #58830
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
In some help text and error output of the go command, the term "main module" gets used, which is very easy to confuse with "package main". I had this confusion when reading #44840. In that thread it was suggested by @ianthehat that maybe the terminology should change, and I think this is a very good idea.
package mainhas existed since the beginning of Go's life, meaning the package that is the entrypoint for a go binary, and the existence of which tells the go command to produce such a binary.
main module.... is very unclear to me. I think it means "that module you specified on the command line when using the go command"? But, the module you specified might not be a
package mainand thus this error is confusingly worded. Using the same descriptor for both is confusing.
The minimum bar would be to call it any thing except
primarywould be acceptable suggestions IMO. However, I don't think there exists a single term that would be clear enough on its own in that error message (and probably anywhere else) to not require further explanation or added context.
Ideally, we'd also rewrite these error messages to be more human-readable for people who aren't go experts.
Here's an example from the above-linked issue:
(This is an example of an attempt at making the error message more clear and helpful. Obviously, the exact message could be different.)
Yes, this is longer, but it's more human-readable, and gives more specific information about a fairly confusing build problem. It tells you what "current module" refers to. It tells you why it's bad that the replace directives are different, using more clear language than "interpreted differently". Finally, it tells you exactly what replace directives are different right in the terminal.
This is sooo much more clear and helpful than our current error message.
The text was updated successfully, but these errors were encountered: