cmd/protoc-gen-go-grpc: add --version flag support (#3921)

This commit is contained in:
Doug Fawley 2020-10-02 11:27:35 -07:00 committed by GitHub
parent d9063e7af3
commit 8fbea72764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -32,14 +32,24 @@ package main
import (
"flag"
"fmt"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)
const version = "1.0"
var requireUnimplemented *bool
func main() {
showVersion := flag.Bool("version", false, "print the version and exit")
flag.Parse()
if *showVersion {
fmt.Printf("protoc-gen-go-grpc %v\n", version)
return
}
var flags flag.FlagSet
requireUnimplemented = flags.Bool("require_unimplemented_servers", true, "set to false to match legacy behavior")