示例#1
0
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]
}
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)
	}
}