cmd/go: document that generate processes packages in command line order #19762
Labels
Documentation
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Suggested
Issues that may be good for new contributors looking for work to do.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
go generate
accepts a number of packages as arguments, packages on which to rungo generate
.go generate -help
makes no mention of the order in which those packages will bego generate
-dThe lack of any mention on the order of execution might well be intentional...
But in any case I'd like to propose we define the order and document it (this issue could conceivably be a proposal, very happy to redo as such)
The use case stems a use case where
go generate
-ors end up parsing dependencies in order to make decisions on their output. In this context, havinggo generate
run in reverse dependency order (there's probably a more precise term?) on the set of packages provided as arguments avoids the need to re-rungo generate
multiple times (which incidentally is the current alternative, clearly not ideal)What did you expect to see?
"Expect" is not the correct word here... because the order is unspecified I can't reasonably have an expectation. More a "hope" perhaps that:
go generate
should run in reverse-dependency order on the set of packages passed to it as arguments.What did you see instead?
It runs in an unspecified order.
cc @robpike perhaps?
The text was updated successfully, but these errors were encountered: