AnalysisNeedsFixearly-in-cyclehelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
In #31859, @cespare suggested rejecting flag.Parse during func init, which is always incorrect (other packages not yet initialized may want to define flags).
We could add a special runtime hook of some kind to allow flag to see whether main.main has started, but that would be unfortunate. There also may be lots of code in the wild that does parse flags during init and kind of works out OK, and if it's working well enough we don't want to break it unnecessarily.
A vet check, on by default during go test, seems like the perfect compromise to me.