Add --go_opt flag to adapt to the version after 1.4.0 of protoc-gen-go (#767)

Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
anqiansong
2021-07-08 10:11:11 +08:00
committed by GitHub
parent 22a1315136
commit efdf475da4
8 changed files with 89 additions and 16 deletions

View File

@@ -36,7 +36,7 @@ func NewRPCGenerator(g Generator, cfg *conf.Config) *RPCGenerator {
// Generate generates an rpc service, through the proto file,
// code storage directory, and proto import parameters to control
// the source file and target location of the rpc service that needs to be generated
func (g *RPCGenerator) Generate(src, target string, protoImportPath []string) error {
func (g *RPCGenerator) Generate(src, target string, protoImportPath []string, goOptions ...string) error {
abs, err := filepath.Abs(target)
if err != nil {
return err
@@ -73,7 +73,7 @@ func (g *RPCGenerator) Generate(src, target string, protoImportPath []string) er
return err
}
err = g.g.GenPb(dirCtx, protoImportPath, proto, g.cfg)
err = g.g.GenPb(dirCtx, protoImportPath, proto, g.cfg, goOptions...)
if err != nil {
return err
}