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: add 'go generate -skip' #38687

Closed
xtonyjiang opened this issue Apr 27, 2020 · 6 comments
Closed

cmd/go: add 'go generate -skip' #38687

xtonyjiang opened this issue Apr 27, 2020 · 6 comments

Comments

@xtonyjiang
Copy link

We currently have the -run flag, but I believe it is currently impossible to supply a regular expression that would allow for excluding a certain expression (due to no lookaheads in Go's regex syntax). Being able to exclude expressions would be useful if we want to exclude certain directives that are time-consuming and are not needed in the moment, and we want to run a large amount of other directives, so that it would be impractical to simply run go generate multiple times with different -run flags.

I think one way to implement this could be an additional flag. Similar to grep's --invert-match flag, we could do something like:

go generate -invertmatch -run="my excluded pattern" ./...

Alternatively, we could also have a different flag that is used instead of -run, like:

go generate -runexcept="my excluded pattern" ./...

Here, supplying both -runexcept and -run would be invalid.

@gopherbot gopherbot added this to the Proposal milestone Apr 27, 2020
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jan 6, 2021
@rsc
Copy link
Contributor

rsc commented Jul 14, 2021

I'm not sure we should do anything here, but if we did, it should apply to the other -run flags too.

@rsc rsc changed the title proposal: cmd/generate: Be able to run directives that *don't* match a specified expression proposal: cmd/go: allow running non-matching rules in go generate Jul 14, 2021
@jayconrod
Copy link
Contributor

#41583 is an accepted proposal for a go test -skip flag that sounds similar. What about bringing that to go generate?

@rsc rsc changed the title proposal: cmd/go: allow running non-matching rules in go generate proposal: cmd/go: add 'go generate -skip' Aug 4, 2021
@rsc rsc moved this from Incoming to Active in Proposals (old) Aug 4, 2021
@rsc
Copy link
Contributor

rsc commented Aug 4, 2021

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Aug 11, 2021

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc rsc moved this from Active to Likely Accept in Proposals (old) Aug 11, 2021
@rsc rsc moved this from Likely Accept to Accepted in Proposals (old) Aug 18, 2021
@rsc
Copy link
Contributor

rsc commented Aug 18, 2021

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: cmd/go: add 'go generate -skip' cmd/go: add 'go generate -skip' Aug 18, 2021
@rsc rsc modified the milestones: Proposal, Backlog Aug 18, 2021
@gopherbot
Copy link

Change https://go.dev/cl/421440 mentions this issue: cmd/go: add go generate -skip flag

@golang golang locked and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

4 participants