-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.help wanted
Milestone
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.
bcmills, cespare, tmthrgd, VojtechVitek, ainar-g and 7 more
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.help wanted