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

testscript: fix RequireExplicitExec error messages #167

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

mvdan
Copy link
Collaborator

@mvdan mvdan commented Jul 24, 2022

(see commit message)

They used args[0], which is the first argument to the command,
rather than the command name itself:

	> gofumpt foo.go
	FAIL: [...] use 'exec foo.go' rather than 'foo.go' (because RequireExplicitExec is enabled)

I believe I introduced this regression when refactoring the pull request
due to Roger's review, as I moved the code out of TestMain, where
args[0] was still the name of the command to be run.

Note that I can't easily add a regression test here, because the
testscript command being used in the tests is not a top-level command
run as a separate process, so it does not produce stdout nor stderr.
The change seems easy enough to review manually,
and our tests don't strictly check all error messages anyway.

While here, remove the unnecessary use of -verbose.
@mvdan mvdan requested review from myitcv and rogpeppe July 24, 2022 11:34
@mvdan mvdan merged commit bb36173 into rogpeppe:master Aug 3, 2022
@mvdan mvdan deleted the require-explicit-exec-arg branch August 3, 2022 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants