Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: undo replacement of -vettool with $GOVETTOOL #28636

Closed
rsc opened this issue Nov 7, 2018 · 2 comments
Closed

cmd/go: undo replacement of -vettool with $GOVETTOOL #28636

rsc opened this issue Nov 7, 2018 · 2 comments

Comments

@rsc
Copy link
Contributor

rsc commented Nov 7, 2018

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.

@rsc rsc self-assigned this Nov 7, 2018
@rsc rsc added this to the Go1.12 milestone Nov 7, 2018
@alandonovan
Copy link
Contributor

alandonovan commented Nov 7, 2018

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.

@gopherbot
Copy link

Change https://golang.org/cl/148497 mentions this issue: cmd/go: vet: revert $GOVETTOOL env var, restore -vettool flag

@golang golang locked and limited conversation to collaborators Nov 8, 2019
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants