fix proto types

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-10-08 12:37:06 +03:00
parent 854839ba45
commit 3aa3132caa
5 changed files with 61 additions and 65 deletions

17
errors_test.go Normal file
View File

@ -0,0 +1,17 @@
package grpc_test
import (
"testing"
pb "github.com/unistack-org/micro-client-grpc/internal/errors"
"google.golang.org/protobuf/types/known/anypb"
)
func TestErrors(t *testing.T) {
any, err := anypb.New(&pb.Error{})
if err != nil {
t.Fatal(err)
}
t.Logf("cli any: %#+v\n", any)
}

View File

@ -1,3 +1,3 @@
package grpc package grpc
//go:generate protoc -I./internal/errors -I. --go-grpc_out=paths=source_relative:./internal/errors --go_out=paths=source_relative:./internal/errors --micro_out=paths=source_relative:./internal/errors internal/errors/errors.proto //go:generate protoc -I./internal/errors -I. --go_out=paths=source_relative:./internal/errors internal/errors/client_errors.proto

View File

@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-go v1.25.0-devel // protoc-gen-go v1.25.0-devel
// protoc v3.6.1 // protoc v3.6.1
// source: errors.proto // source: client_errors.proto
package errors package errors
@ -39,7 +39,7 @@ type Error struct {
func (x *Error) Reset() { func (x *Error) Reset() {
*x = Error{} *x = Error{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_errors_proto_msgTypes[0] mi := &file_client_errors_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -52,7 +52,7 @@ func (x *Error) String() string {
func (*Error) ProtoMessage() {} func (*Error) ProtoMessage() {}
func (x *Error) ProtoReflect() protoreflect.Message { func (x *Error) ProtoReflect() protoreflect.Message {
mi := &file_errors_proto_msgTypes[0] mi := &file_client_errors_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -65,7 +65,7 @@ func (x *Error) ProtoReflect() protoreflect.Message {
// Deprecated: Use Error.ProtoReflect.Descriptor instead. // Deprecated: Use Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) { func (*Error) Descriptor() ([]byte, []int) {
return file_errors_proto_rawDescGZIP(), []int{0} return file_client_errors_proto_rawDescGZIP(), []int{0}
} }
func (x *Error) GetId() string { func (x *Error) GetId() string {
@ -96,42 +96,42 @@ func (x *Error) GetStatus() string {
return "" return ""
} }
var File_errors_proto protoreflect.FileDescriptor var File_client_errors_proto protoreflect.FileDescriptor
var file_errors_proto_rawDesc = []byte{ var file_client_errors_proto_rawDesc = []byte{
0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x0a, 0x13, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e,
0x6f, 0x72, 0x67, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6d, 0x69, 0x63, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74,
0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x65, 0x61, 0x63, 0x6b, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73,
0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x5b, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x22, 0x5b, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a,
0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64,
0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x3b, 0x5a,
0x75, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x6e, 0x69, 0x73,
0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x63,
0x63, 0x72, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x62, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6f, 0x33,
} }
var ( var (
file_errors_proto_rawDescOnce sync.Once file_client_errors_proto_rawDescOnce sync.Once
file_errors_proto_rawDescData = file_errors_proto_rawDesc file_client_errors_proto_rawDescData = file_client_errors_proto_rawDesc
) )
func file_errors_proto_rawDescGZIP() []byte { func file_client_errors_proto_rawDescGZIP() []byte {
file_errors_proto_rawDescOnce.Do(func() { file_client_errors_proto_rawDescOnce.Do(func() {
file_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_errors_proto_rawDescData) file_client_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_errors_proto_rawDescData)
}) })
return file_errors_proto_rawDescData return file_client_errors_proto_rawDescData
} }
var file_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_client_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_errors_proto_goTypes = []interface{}{ var file_client_errors_proto_goTypes = []interface{}{
(*Error)(nil), // 0: org.unistack.micro.client.grpc.errors.Error (*Error)(nil), // 0: org.unistack.micro.errors.Error
} }
var file_errors_proto_depIdxs = []int32{ var file_client_errors_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension type_name
@ -139,13 +139,13 @@ var file_errors_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for field type_name 0, // [0:0] is the sub-list for field type_name
} }
func init() { file_errors_proto_init() } func init() { file_client_errors_proto_init() }
func file_errors_proto_init() { func file_client_errors_proto_init() {
if File_errors_proto != nil { if File_client_errors_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_client_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Error); i { switch v := v.(*Error); i {
case 0: case 0:
return &v.state return &v.state
@ -162,18 +162,18 @@ func file_errors_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_errors_proto_rawDesc, RawDescriptor: file_client_errors_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 1, NumMessages: 1,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_errors_proto_goTypes, GoTypes: file_client_errors_proto_goTypes,
DependencyIndexes: file_errors_proto_depIdxs, DependencyIndexes: file_client_errors_proto_depIdxs,
MessageInfos: file_errors_proto_msgTypes, MessageInfos: file_client_errors_proto_msgTypes,
}.Build() }.Build()
File_errors_proto = out.File File_client_errors_proto = out.File
file_errors_proto_rawDesc = nil file_client_errors_proto_rawDesc = nil
file_errors_proto_goTypes = nil file_client_errors_proto_goTypes = nil
file_errors_proto_depIdxs = nil file_client_errors_proto_depIdxs = nil
} }

View File

@ -1,7 +1,7 @@
syntax = "proto3"; syntax = "proto3";
option go_package = "github.com/unistack-org/micro-client-grpc/internal/errors"; option go_package = "github.com/unistack-org/micro-client-grpc/internal/errors";
package org.unistack.micro.client.grpc.errors; package org.unistack.micro.errors;
message Error { message Error {
string id = 1; string id = 1;

View File

@ -1,21 +0,0 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: errors.proto
package errors
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package