1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-29 21:47:44 +02:00

try fixing staticcheck warning (#2190)

https://github.com/golang/protobuf/issues/1077
package github.com/golang/protobuf/proto is deprecated: Use the "google.golang.org/protobuf/proto" package instead.  (SA1019)
This commit is contained in:
Johnson C
2021-07-06 19:51:28 +08:00
committed by GitHub
parent 1c482e8922
commit 7f1de77e8c
10 changed files with 251 additions and 337 deletions

View File

@@ -7,9 +7,9 @@ import (
"strings"
"github.com/asim/go-micro/cmd/protoc-gen-micro/v3/generator"
"github.com/golang/protobuf/proto"
pb "github.com/golang/protobuf/protoc-gen-go/descriptor"
options "google.golang.org/genproto/googleapis/api/annotations"
"google.golang.org/protobuf/proto"
pb "google.golang.org/protobuf/types/descriptorpb"
)
// Paths for packages used by code generated in this file,
@@ -150,7 +150,7 @@ func (g *micro) generateService(file *generator.FileDescriptor, service *pb.Serv
g.P("return []*", apiPkg, ".Endpoint{")
for _, method := range service.Method {
if method.Options != nil && proto.HasExtension(method.Options, options.E_Http) {
g.P("&", apiPkg, ".Endpoint{")
g.P("{")
g.generateEndpoint(servName, method)
g.P("},")
}
@@ -275,10 +275,7 @@ func (g *micro) generateEndpoint(servName string, method *pb.MethodDescriptorPro
return
}
// http rules
r, err := proto.GetExtension(method.Options, options.E_Http)
if err != nil {
return
}
r := proto.GetExtension(method.Options, options.E_Http)
rule := r.(*options.HttpRule)
var meth string
var path string