Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: undo replacement of -vettool with $GOVETTOOL #28636
Recently @alandonovan replaced -vettool with $GOVETTOOL because it simplified command line parsing a little. We should undo that. An environment variable is not appropriate for per-command configuration - that's what the command line is for - and the parsing of -vettool can run the tool to learn the other flags.
The problem that the environment variable solves is that by the time you parse the -vettool flag, it's too late to run that tool to report its flags because you've already started parsed the command line.
An alternative might be to implement an ad-hoc command-line parser that searches for -vettool or -vettool=... among os.Args and ignores all other arguments. It's not 100% correct w.r.t. flag parsing semantics but it might be good enough.