You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kratos/cmd/protoc-gen-go-http/main.go

38 lines
764 B

4 years ago
package main
import (
"flag"
"fmt"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)
4 years ago
const version = "v2.0.0-rc7"
4 years ago
func main() {
showVersion := flag.Bool("version", false, "print the version and exit")
omitempty := flag.Bool("omitempty", true, "omit if google.api is empty")
4 years ago
flag.Parse()
if *showVersion {
fmt.Printf("protoc-gen-go-http %v\n", version)
return
}
//var flags flag.FlagSet
4 years ago
protogen.Options{
ParamFunc: flag.CommandLine.Set,
4 years ago
}.Run(func(gen *protogen.Plugin) error {
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
for _, f := range gen.Files {
if !f.Generate {
continue
}
generateFile(gen, f, *omitempty)
4 years ago
}
return nil
})
}