Skip to content

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

@xtonyjiang

Description

@xtonyjiang

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions