本文整理汇总了Golang中github.com/golang/protobuf/protoc-gen-go/descriptor.ServiceDescriptorProto.GetMethod方法的典型用法代码示例。如果您正苦于以下问题:Golang ServiceDescriptorProto.GetMethod方法的具体用法?Golang ServiceDescriptorProto.GetMethod怎么用?Golang ServiceDescriptorProto.GetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/golang/protobuf/protoc-gen-go/descriptor.ServiceDescriptorProto
的用法示例。
在下文中一共展示了ServiceDescriptorProto.GetMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: fillTreeWithService
func fillTreeWithService(tree *tree, key string, proto *descriptor.ServiceDescriptorProto, loc string, locs map[string]*descriptor.SourceCodeInfo_Location) *service {
key = fmt.Sprintf("%s.%s", key, proto.GetName())
tree.services[key] = &service{key: key, comment: getComment(loc, locs), ServiceDescriptorProto: proto}
// Methods
for idx, proto := range proto.GetMethod() {
method := fillTreeWithMethod(tree, key, proto, fmt.Sprintf("%s,2,%d", loc, idx), locs)
tree.services[key].methods = append(tree.services[key].methods, method)
}
return tree.services[key]
}
示例2: lintProtoService
func (p *protoBufErrors) lintProtoService(
pathIndex int32,
protoService *descriptor.ServiceDescriptorProto,
) {
path := []int32{
pathService,
pathIndex,
}
if !isCamelCase(protoService.GetName()) {
p.addError(&protoBufError{
path: path,
errorCode: errorServiceCase,
errorString: protoService.GetName(),
})
}
for i, v := range protoService.GetMethod() {
p.lintProtoRPCMethod(int32(i), path, v)
}
}