compiler/protogen: add (*GeneratedFile).Unskip

Simplifies some compiler plugins who want to avoid generating empty
files. With this API, generated files can be skipped by default, and
unskipped when actual code is generated.

Change-Id: I941c821646f5c4430a84e08bbad7e021434b1e71
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/232239
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
Oscar Söderlund 2020-05-06 06:04:40 +02:00 committed by Joe Tsai
parent 1f5b6fe645
commit 8525b20428

View File

@ -1109,6 +1109,12 @@ func (g *GeneratedFile) Skip() {
g.skip = true
}
// Unskip reverts a previous call to Skip, re-including the generated file in
// the plugin output.
func (g *GeneratedFile) Unskip() {
g.skip = false
}
// Annotate associates a symbol in a generated Go file with a location in a
// source .proto file.
//