diff --git a/protobuf/protoc-gen-go-grain/Makefile b/protobuf/protoc-gen-go-grain/Makefile index 51503bc6..81c232b7 100644 --- a/protobuf/protoc-gen-go-grain/Makefile +++ b/protobuf/protoc-gen-go-grain/Makefile @@ -1,9 +1,9 @@ .PHONY: testdata testdata: - protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/hello/*.proto - protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/reenter/*.proto - protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/multi-services/*.proto - protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/error/*.proto + protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/hello/*.proto + protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/reenter/*.proto + protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/multi-services/*.proto + protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/error/*.proto .PHONY: options options: diff --git a/protobuf/protoc-gen-go-grain/generate.go b/protobuf/protoc-gen-go-grain/generate.go index 2486bac3..bd63bc81 100644 --- a/protobuf/protoc-gen-go-grain/generate.go +++ b/protobuf/protoc-gen-go-grain/generate.go @@ -30,14 +30,15 @@ var ( ) func generateFile(gen *protogen.Plugin, file *protogen.File) { - if len(file.Services) == 0 { + if len(file.Services) == 0 && len(file.Enums) == 0 { return } + filename := file.GeneratedFilenamePrefix + "_grain.pb.go" g := gen.NewGeneratedFile(filename, file.GoImportPath) generateHeader(gen, g, file) - generateContent(gen, g, file) + generateContent(g, file) } func generateHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, file *protogen.File) { @@ -60,19 +61,11 @@ func generateHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, file *proto g.P() } -func generateContent(gen *protogen.Plugin, g *protogen.GeneratedFile, file *protogen.File) { +func generateContent(g *protogen.GeneratedFile, file *protogen.File) { g.P("package ", file.GoPackageName) - if len(file.Services) == 0 { - return - } - - g.QualifiedGoIdent(actorPackage.Ident("")) g.QualifiedGoIdent(clusterPackage.Ident("")) - g.QualifiedGoIdent(protoPackage.Ident("")) g.QualifiedGoIdent(fmtPackage.Ident("")) - g.QualifiedGoIdent(timePackage.Ident("")) - g.QualifiedGoIdent(slogPackage.Ident("")) for _, enum := range file.Enums { if enum.Desc.Name() == "ErrorReason" { @@ -80,15 +73,24 @@ func generateContent(gen *protogen.Plugin, g *protogen.GeneratedFile, file *prot } } + if len(file.Services) == 0 { + return + } + + g.QualifiedGoIdent(actorPackage.Ident("")) + g.QualifiedGoIdent(protoPackage.Ident("")) + g.QualifiedGoIdent(timePackage.Ident("")) + g.QualifiedGoIdent(slogPackage.Ident("")) + for _, service := range file.Services { - generateService(service, file, g) + generateService(service, g) g.P() } generateRespond(g) } -func generateService(service *protogen.Service, file *protogen.File, g *protogen.GeneratedFile) { +func generateService(service *protogen.Service, g *protogen.GeneratedFile) { if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { g.P("//") g.P(deprecationComment) diff --git a/protobuf/protoc-gen-go-grain/test/error/error.pb.go b/protobuf/protoc-gen-go-grain/test/error/error.pb.go new file mode 100644 index 00000000..554197a8 --- /dev/null +++ b/protobuf/protoc-gen-go-grain/test/error/error.pb.go @@ -0,0 +1,132 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.0 +// source: test/error/error.proto + +package hello + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ErrorReason int32 + +const ( + ErrorReason_USER_NOT_FOUND ErrorReason = 0 + ErrorReason_CONTENT_MISSING ErrorReason = 1 +) + +// Enum value maps for ErrorReason. +var ( + ErrorReason_name = map[int32]string{ + 0: "USER_NOT_FOUND", + 1: "CONTENT_MISSING", + } + ErrorReason_value = map[string]int32{ + "USER_NOT_FOUND": 0, + "CONTENT_MISSING": 1, + } +) + +func (x ErrorReason) Enum() *ErrorReason { + p := new(ErrorReason) + *p = x + return p +} + +func (x ErrorReason) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ErrorReason) Descriptor() protoreflect.EnumDescriptor { + return file_test_error_error_proto_enumTypes[0].Descriptor() +} + +func (ErrorReason) Type() protoreflect.EnumType { + return &file_test_error_error_proto_enumTypes[0] +} + +func (x ErrorReason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ErrorReason.Descriptor instead. +func (ErrorReason) EnumDescriptor() ([]byte, []int) { + return file_test_error_error_proto_rawDescGZIP(), []int{0} +} + +var File_test_error_error_proto protoreflect.FileDescriptor + +var file_test_error_error_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2f, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2a, + 0x36, 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x0e, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, + 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x54, 0x5f, 0x4d, 0x49, + 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_test_error_error_proto_rawDescOnce sync.Once + file_test_error_error_proto_rawDescData = file_test_error_error_proto_rawDesc +) + +func file_test_error_error_proto_rawDescGZIP() []byte { + file_test_error_error_proto_rawDescOnce.Do(func() { + file_test_error_error_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_error_error_proto_rawDescData) + }) + return file_test_error_error_proto_rawDescData +} + +var file_test_error_error_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_test_error_error_proto_goTypes = []interface{}{ + (ErrorReason)(0), // 0: hello.ErrorReason +} +var file_test_error_error_proto_depIdxs = []int32{ + 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 extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_test_error_error_proto_init() } +func file_test_error_error_proto_init() { + if File_test_error_error_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_test_error_error_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_test_error_error_proto_goTypes, + DependencyIndexes: file_test_error_error_proto_depIdxs, + EnumInfos: file_test_error_error_proto_enumTypes, + }.Build() + File_test_error_error_proto = out.File + file_test_error_error_proto_rawDesc = nil + file_test_error_error_proto_goTypes = nil + file_test_error_error_proto_depIdxs = nil +} diff --git a/protobuf/protoc-gen-go-grain/testdata/error/hello.proto b/protobuf/protoc-gen-go-grain/test/error/error.proto similarity index 52% rename from protobuf/protoc-gen-go-grain/testdata/error/hello.proto rename to protobuf/protoc-gen-go-grain/test/error/error.proto index 3a2e0eca..5cf23283 100644 --- a/protobuf/protoc-gen-go-grain/testdata/error/hello.proto +++ b/protobuf/protoc-gen-go-grain/test/error/error.proto @@ -2,19 +2,9 @@ syntax = "proto3"; package hello; -import "google/protobuf/empty.proto"; - option go_package = "github.com/asynkron/protoactor-go/protoc-gen-go-grain/testdata/hello"; enum ErrorReason { USER_NOT_FOUND = 0; CONTENT_MISSING = 1; } - -message SayHelloResponse { - string message = 1; -} - -service Hello { - rpc SayHello (google.protobuf.Empty) returns (SayHelloResponse) {} -} \ No newline at end of file diff --git a/protobuf/protoc-gen-go-grain/test/error/error_grain.pb.go b/protobuf/protoc-gen-go-grain/test/error/error_grain.pb.go new file mode 100644 index 00000000..b4803c81 --- /dev/null +++ b/protobuf/protoc-gen-go-grain/test/error/error_grain.pb.go @@ -0,0 +1,36 @@ +// Code generated by protoc-gen-grain. DO NOT EDIT. +// versions: +// protoc-gen-grain v0.6.0 +// protoc v4.25.0 +// source: test/error/error.proto + +package hello + +import ( + fmt "fmt" + cluster "github.com/asynkron/protoactor-go/cluster" +) + +func ErrUserNotFound(format string, args ...interface{}) *cluster.GrainErrorResponse { + return cluster.NewGrainErrorResponse(ErrorReason_USER_NOT_FOUND.String(), fmt.Sprintf(format, args...)) +} + +func IsUserNotFound(err error) bool { + if err == nil { + return false + } + e := cluster.FromError(err) + return e.Reason == ErrorReason_USER_NOT_FOUND.String() +} + +func ErrContentMissing(format string, args ...interface{}) *cluster.GrainErrorResponse { + return cluster.NewGrainErrorResponse(ErrorReason_CONTENT_MISSING.String(), fmt.Sprintf(format, args...)) +} + +func IsContentMissing(err error) bool { + if err == nil { + return false + } + e := cluster.FromError(err) + return e.Reason == ErrorReason_CONTENT_MISSING.String() +} diff --git a/protobuf/protoc-gen-go-grain/test/hello/hello.pb.go b/protobuf/protoc-gen-go-grain/test/hello/hello.pb.go new file mode 100644 index 00000000..b2f2b527 --- /dev/null +++ b/protobuf/protoc-gen-go-grain/test/hello/hello.pb.go @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.0 +// source: test/hello/hello.proto + +package hello + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SayHelloResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *SayHelloResponse) Reset() { + *x = SayHelloResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_test_hello_hello_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SayHelloResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SayHelloResponse) ProtoMessage() {} + +func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { + mi := &file_test_hello_hello_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead. +func (*SayHelloResponse) Descriptor() ([]byte, []int) { + return file_test_hello_hello_proto_rawDescGZIP(), []int{0} +} + +func (x *SayHelloResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_test_hello_hello_proto protoreflect.FileDescriptor + +var file_test_hello_hello_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2f, 0x68, 0x65, 0x6c, + 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x1a, + 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x10, + 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x46, 0x0a, 0x05, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x12, 0x3d, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, + 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_test_hello_hello_proto_rawDescOnce sync.Once + file_test_hello_hello_proto_rawDescData = file_test_hello_hello_proto_rawDesc +) + +func file_test_hello_hello_proto_rawDescGZIP() []byte { + file_test_hello_hello_proto_rawDescOnce.Do(func() { + file_test_hello_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_hello_hello_proto_rawDescData) + }) + return file_test_hello_hello_proto_rawDescData +} + +var file_test_hello_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_test_hello_hello_proto_goTypes = []interface{}{ + (*SayHelloResponse)(nil), // 0: hello.SayHelloResponse + (*emptypb.Empty)(nil), // 1: google.protobuf.Empty +} +var file_test_hello_hello_proto_depIdxs = []int32{ + 1, // 0: hello.Hello.SayHello:input_type -> google.protobuf.Empty + 0, // 1: hello.Hello.SayHello:output_type -> hello.SayHelloResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] 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 extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_test_hello_hello_proto_init() } +func file_test_hello_hello_proto_init() { + if File_test_hello_hello_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_test_hello_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SayHelloResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_test_hello_hello_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_test_hello_hello_proto_goTypes, + DependencyIndexes: file_test_hello_hello_proto_depIdxs, + MessageInfos: file_test_hello_hello_proto_msgTypes, + }.Build() + File_test_hello_hello_proto = out.File + file_test_hello_hello_proto_rawDesc = nil + file_test_hello_hello_proto_goTypes = nil + file_test_hello_hello_proto_depIdxs = nil +} diff --git a/protobuf/protoc-gen-go-grain/testdata/hello/hello.proto b/protobuf/protoc-gen-go-grain/test/hello/hello.proto similarity index 100% rename from protobuf/protoc-gen-go-grain/testdata/hello/hello.proto rename to protobuf/protoc-gen-go-grain/test/hello/hello.proto diff --git a/protobuf/protoc-gen-go-grain/testdata/hello/hello_grain.pb.go b/protobuf/protoc-gen-go-grain/test/hello/hello_grain.pb.go similarity index 98% rename from protobuf/protoc-gen-go-grain/testdata/hello/hello_grain.pb.go rename to protobuf/protoc-gen-go-grain/test/hello/hello_grain.pb.go index f7230ecf..d2aa55e7 100644 --- a/protobuf/protoc-gen-go-grain/testdata/hello/hello_grain.pb.go +++ b/protobuf/protoc-gen-go-grain/test/hello/hello_grain.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-grain. DO NOT EDIT. // versions: -// protoc-gen-grain v0.5.0 +// protoc-gen-grain v0.6.0 // protoc v4.25.0 -// source: testdata/hello/hello.proto +// source: test/hello/hello.proto package hello diff --git a/protobuf/protoc-gen-go-grain/testdata/multi-services/services.pb.go b/protobuf/protoc-gen-go-grain/test/multi-services/services.pb.go similarity index 50% rename from protobuf/protoc-gen-go-grain/testdata/multi-services/services.pb.go rename to protobuf/protoc-gen-go-grain/test/multi-services/services.pb.go index 81988ab0..f3d1c9a9 100644 --- a/protobuf/protoc-gen-go-grain/testdata/multi-services/services.pb.go +++ b/protobuf/protoc-gen-go-grain/test/multi-services/services.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.25.0 -// source: testdata/multi-services/services.proto +// source: test/multi-services/services.proto package hello @@ -32,7 +32,7 @@ type SayHelloResponse struct { func (x *SayHelloResponse) Reset() { *x = SayHelloResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_multi_services_services_proto_msgTypes[0] + mi := &file_test_multi_services_services_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *SayHelloResponse) String() string { func (*SayHelloResponse) ProtoMessage() {} func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_multi_services_services_proto_msgTypes[0] + mi := &file_test_multi_services_services_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -58,7 +58,7 @@ func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead. func (*SayHelloResponse) Descriptor() ([]byte, []int) { - return file_testdata_multi_services_services_proto_rawDescGZIP(), []int{0} + return file_test_multi_services_services_proto_rawDescGZIP(), []int{0} } func (x *SayHelloResponse) GetMessage() string { @@ -79,7 +79,7 @@ type DoWorkRequest struct { func (x *DoWorkRequest) Reset() { *x = DoWorkRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_multi_services_services_proto_msgTypes[1] + mi := &file_test_multi_services_services_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92,7 +92,7 @@ func (x *DoWorkRequest) String() string { func (*DoWorkRequest) ProtoMessage() {} func (x *DoWorkRequest) ProtoReflect() protoreflect.Message { - mi := &file_testdata_multi_services_services_proto_msgTypes[1] + mi := &file_test_multi_services_services_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105,7 +105,7 @@ func (x *DoWorkRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DoWorkRequest.ProtoReflect.Descriptor instead. func (*DoWorkRequest) Descriptor() ([]byte, []int) { - return file_testdata_multi_services_services_proto_rawDescGZIP(), []int{1} + return file_test_multi_services_services_proto_rawDescGZIP(), []int{1} } func (x *DoWorkRequest) GetWork() string { @@ -126,7 +126,7 @@ type DoWorkResponse struct { func (x *DoWorkResponse) Reset() { *x = DoWorkResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_multi_services_services_proto_msgTypes[2] + mi := &file_test_multi_services_services_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -139,7 +139,7 @@ func (x *DoWorkResponse) String() string { func (*DoWorkResponse) ProtoMessage() {} func (x *DoWorkResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_multi_services_services_proto_msgTypes[2] + mi := &file_test_multi_services_services_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -152,7 +152,7 @@ func (x *DoWorkResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DoWorkResponse.ProtoReflect.Descriptor instead. func (*DoWorkResponse) Descriptor() ([]byte, []int) { - return file_testdata_multi_services_services_proto_rawDescGZIP(), []int{2} + return file_test_multi_services_services_proto_rawDescGZIP(), []int{2} } func (x *DoWorkResponse) GetResult() string { @@ -162,58 +162,57 @@ func (x *DoWorkResponse) GetResult() string { return "" } -var File_testdata_multi_services_services_proto protoreflect.FileDescriptor - -var file_testdata_multi_services_services_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x1a, - 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x10, - 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x44, 0x6f, - 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x77, - 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x77, 0x6f, 0x72, 0x6b, 0x22, - 0x28, 0x0a, 0x0e, 0x44, 0x6f, 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0x46, 0x0a, 0x05, 0x48, 0x65, 0x6c, - 0x6c, 0x6f, 0x12, 0x3d, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, - 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x32, 0x3f, 0x0a, 0x04, 0x57, 0x6f, 0x72, 0x6b, 0x12, 0x37, 0x0a, 0x06, 0x44, 0x6f, 0x57, - 0x6f, 0x72, 0x6b, 0x12, 0x14, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x44, 0x6f, 0x57, 0x6f, - 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x68, 0x65, 0x6c, 0x6c, - 0x6f, 0x2e, 0x44, 0x6f, 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, - 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, - 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, +var File_test_multi_services_services_proto protoreflect.FileDescriptor + +var file_test_multi_services_services_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, + 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x10, 0x53, 0x61, 0x79, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x44, 0x6f, 0x57, 0x6f, 0x72, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x77, 0x6f, 0x72, 0x6b, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x77, 0x6f, 0x72, 0x6b, 0x22, 0x28, 0x0a, 0x0e, 0x44, + 0x6f, 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0x46, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x3d, + 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x3f, 0x0a, + 0x04, 0x57, 0x6f, 0x72, 0x6b, 0x12, 0x37, 0x0a, 0x06, 0x44, 0x6f, 0x57, 0x6f, 0x72, 0x6b, 0x12, + 0x14, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x44, 0x6f, 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x44, 0x6f, + 0x57, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x46, + 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, + 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, + 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, + 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, + 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_testdata_multi_services_services_proto_rawDescOnce sync.Once - file_testdata_multi_services_services_proto_rawDescData = file_testdata_multi_services_services_proto_rawDesc + file_test_multi_services_services_proto_rawDescOnce sync.Once + file_test_multi_services_services_proto_rawDescData = file_test_multi_services_services_proto_rawDesc ) -func file_testdata_multi_services_services_proto_rawDescGZIP() []byte { - file_testdata_multi_services_services_proto_rawDescOnce.Do(func() { - file_testdata_multi_services_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_testdata_multi_services_services_proto_rawDescData) +func file_test_multi_services_services_proto_rawDescGZIP() []byte { + file_test_multi_services_services_proto_rawDescOnce.Do(func() { + file_test_multi_services_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_multi_services_services_proto_rawDescData) }) - return file_testdata_multi_services_services_proto_rawDescData + return file_test_multi_services_services_proto_rawDescData } -var file_testdata_multi_services_services_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_testdata_multi_services_services_proto_goTypes = []interface{}{ +var file_test_multi_services_services_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_test_multi_services_services_proto_goTypes = []interface{}{ (*SayHelloResponse)(nil), // 0: hello.SayHelloResponse (*DoWorkRequest)(nil), // 1: hello.DoWorkRequest (*DoWorkResponse)(nil), // 2: hello.DoWorkResponse (*emptypb.Empty)(nil), // 3: google.protobuf.Empty } -var file_testdata_multi_services_services_proto_depIdxs = []int32{ +var file_test_multi_services_services_proto_depIdxs = []int32{ 3, // 0: hello.Hello.SayHello:input_type -> google.protobuf.Empty 1, // 1: hello.Work.DoWork:input_type -> hello.DoWorkRequest 0, // 2: hello.Hello.SayHello:output_type -> hello.SayHelloResponse @@ -225,13 +224,13 @@ var file_testdata_multi_services_services_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_testdata_multi_services_services_proto_init() } -func file_testdata_multi_services_services_proto_init() { - if File_testdata_multi_services_services_proto != nil { +func init() { file_test_multi_services_services_proto_init() } +func file_test_multi_services_services_proto_init() { + if File_test_multi_services_services_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_testdata_multi_services_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_test_multi_services_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SayHelloResponse); i { case 0: return &v.state @@ -243,7 +242,7 @@ func file_testdata_multi_services_services_proto_init() { return nil } } - file_testdata_multi_services_services_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_test_multi_services_services_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DoWorkRequest); i { case 0: return &v.state @@ -255,7 +254,7 @@ func file_testdata_multi_services_services_proto_init() { return nil } } - file_testdata_multi_services_services_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_test_multi_services_services_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DoWorkResponse); i { case 0: return &v.state @@ -272,18 +271,18 @@ func file_testdata_multi_services_services_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testdata_multi_services_services_proto_rawDesc, + RawDescriptor: file_test_multi_services_services_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 2, }, - GoTypes: file_testdata_multi_services_services_proto_goTypes, - DependencyIndexes: file_testdata_multi_services_services_proto_depIdxs, - MessageInfos: file_testdata_multi_services_services_proto_msgTypes, + GoTypes: file_test_multi_services_services_proto_goTypes, + DependencyIndexes: file_test_multi_services_services_proto_depIdxs, + MessageInfos: file_test_multi_services_services_proto_msgTypes, }.Build() - File_testdata_multi_services_services_proto = out.File - file_testdata_multi_services_services_proto_rawDesc = nil - file_testdata_multi_services_services_proto_goTypes = nil - file_testdata_multi_services_services_proto_depIdxs = nil + File_test_multi_services_services_proto = out.File + file_test_multi_services_services_proto_rawDesc = nil + file_test_multi_services_services_proto_goTypes = nil + file_test_multi_services_services_proto_depIdxs = nil } diff --git a/protobuf/protoc-gen-go-grain/testdata/multi-services/services.proto b/protobuf/protoc-gen-go-grain/test/multi-services/services.proto similarity index 100% rename from protobuf/protoc-gen-go-grain/testdata/multi-services/services.proto rename to protobuf/protoc-gen-go-grain/test/multi-services/services.proto diff --git a/protobuf/protoc-gen-go-grain/testdata/multi-services/services_grain.pb.go b/protobuf/protoc-gen-go-grain/test/multi-services/services_grain.pb.go similarity index 99% rename from protobuf/protoc-gen-go-grain/testdata/multi-services/services_grain.pb.go rename to protobuf/protoc-gen-go-grain/test/multi-services/services_grain.pb.go index 61f4686b..1b17472a 100644 --- a/protobuf/protoc-gen-go-grain/testdata/multi-services/services_grain.pb.go +++ b/protobuf/protoc-gen-go-grain/test/multi-services/services_grain.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-grain. DO NOT EDIT. // versions: -// protoc-gen-grain v0.5.0 +// protoc-gen-grain v0.6.0 // protoc v4.25.0 -// source: testdata/multi-services/services.proto +// source: test/multi-services/services.proto package hello diff --git a/protobuf/protoc-gen-go-grain/testdata/reenter/hello.pb.go b/protobuf/protoc-gen-go-grain/test/reenter/hello.pb.go similarity index 54% rename from protobuf/protoc-gen-go-grain/testdata/reenter/hello.pb.go rename to protobuf/protoc-gen-go-grain/test/reenter/hello.pb.go index fa3b59f5..751e5b26 100644 --- a/protobuf/protoc-gen-go-grain/testdata/reenter/hello.pb.go +++ b/protobuf/protoc-gen-go-grain/test/reenter/hello.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.25.0 -// source: testdata/reenter/hello.proto +// source: test/reenter/hello.proto package hello @@ -32,7 +32,7 @@ type SayHelloRequest struct { func (x *SayHelloRequest) Reset() { *x = SayHelloRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_reenter_hello_proto_msgTypes[0] + mi := &file_test_reenter_hello_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *SayHelloRequest) String() string { func (*SayHelloRequest) ProtoMessage() {} func (x *SayHelloRequest) ProtoReflect() protoreflect.Message { - mi := &file_testdata_reenter_hello_proto_msgTypes[0] + mi := &file_test_reenter_hello_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -58,7 +58,7 @@ func (x *SayHelloRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SayHelloRequest.ProtoReflect.Descriptor instead. func (*SayHelloRequest) Descriptor() ([]byte, []int) { - return file_testdata_reenter_hello_proto_rawDescGZIP(), []int{0} + return file_test_reenter_hello_proto_rawDescGZIP(), []int{0} } func (x *SayHelloRequest) GetName() string { @@ -79,7 +79,7 @@ type SayHelloResponse struct { func (x *SayHelloResponse) Reset() { *x = SayHelloResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_reenter_hello_proto_msgTypes[1] + mi := &file_test_reenter_hello_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92,7 +92,7 @@ func (x *SayHelloResponse) String() string { func (*SayHelloResponse) ProtoMessage() {} func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_reenter_hello_proto_msgTypes[1] + mi := &file_test_reenter_hello_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105,7 +105,7 @@ func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead. func (*SayHelloResponse) Descriptor() ([]byte, []int) { - return file_testdata_reenter_hello_proto_rawDescGZIP(), []int{1} + return file_test_reenter_hello_proto_rawDescGZIP(), []int{1} } func (x *SayHelloResponse) GetMessage() string { @@ -126,7 +126,7 @@ type DoworkRequest struct { func (x *DoworkRequest) Reset() { *x = DoworkRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_reenter_hello_proto_msgTypes[2] + mi := &file_test_reenter_hello_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -139,7 +139,7 @@ func (x *DoworkRequest) String() string { func (*DoworkRequest) ProtoMessage() {} func (x *DoworkRequest) ProtoReflect() protoreflect.Message { - mi := &file_testdata_reenter_hello_proto_msgTypes[2] + mi := &file_test_reenter_hello_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -152,7 +152,7 @@ func (x *DoworkRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DoworkRequest.ProtoReflect.Descriptor instead. func (*DoworkRequest) Descriptor() ([]byte, []int) { - return file_testdata_reenter_hello_proto_rawDescGZIP(), []int{2} + return file_test_reenter_hello_proto_rawDescGZIP(), []int{2} } func (x *DoworkRequest) GetName() string { @@ -173,7 +173,7 @@ type DoworkResponse struct { func (x *DoworkResponse) Reset() { *x = DoworkResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testdata_reenter_hello_proto_msgTypes[3] + mi := &file_test_reenter_hello_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -186,7 +186,7 @@ func (x *DoworkResponse) String() string { func (*DoworkResponse) ProtoMessage() {} func (x *DoworkResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_reenter_hello_proto_msgTypes[3] + mi := &file_test_reenter_hello_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -199,7 +199,7 @@ func (x *DoworkResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DoworkResponse.ProtoReflect.Descriptor instead. func (*DoworkResponse) Descriptor() ([]byte, []int) { - return file_testdata_reenter_hello_proto_rawDescGZIP(), []int{3} + return file_test_reenter_hello_proto_rawDescGZIP(), []int{3} } func (x *DoworkResponse) GetMessage() string { @@ -209,61 +209,61 @@ func (x *DoworkResponse) GetMessage() string { return "" } -var File_testdata_reenter_hello_proto protoreflect.FileDescriptor - -var file_testdata_reenter_hello_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x72, 0x65, 0x65, 0x6e, 0x74, - 0x65, 0x72, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, - 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x1a, 0x32, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, - 0x61, 0x69, 0x6e, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x25, 0x0a, 0x0f, 0x53, 0x61, 0x79, - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0x2c, 0x0a, 0x10, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, - 0x0a, 0x0d, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x22, 0x2a, 0x0a, 0x0e, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, - 0x8b, 0x01, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x43, 0x0a, 0x08, 0x53, 0x61, 0x79, - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, - 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, - 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x82, 0xb5, 0x18, 0x02, 0x08, 0x01, 0x12, 0x3d, - 0x0a, 0x06, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x14, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, - 0x2e, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, - 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x82, 0xb5, 0x18, 0x02, 0x10, 0x01, 0x42, 0x46, 0x5a, - 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, 0x6e, - 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2d, - 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, - 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, - 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_test_reenter_hello_proto protoreflect.FileDescriptor + +var file_test_reenter_hello_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x72, 0x65, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x68, + 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, 0x6c, 0x6c, + 0x6f, 0x1a, 0x32, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x25, 0x0a, 0x0f, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2c, 0x0a, 0x10, + 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x44, 0x6f, + 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x2a, 0x0a, 0x0e, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x8b, 0x01, 0x0a, 0x05, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x43, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x12, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, + 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x06, 0x82, 0xb5, 0x18, 0x02, 0x08, 0x01, 0x12, 0x3d, 0x0a, 0x06, 0x44, 0x6f, + 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x14, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x44, 0x6f, 0x77, + 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x68, 0x65, 0x6c, + 0x6c, 0x6f, 0x2e, 0x44, 0x6f, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x06, 0x82, 0xb5, 0x18, 0x02, 0x10, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x6b, 0x72, 0x6f, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, + 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_testdata_reenter_hello_proto_rawDescOnce sync.Once - file_testdata_reenter_hello_proto_rawDescData = file_testdata_reenter_hello_proto_rawDesc + file_test_reenter_hello_proto_rawDescOnce sync.Once + file_test_reenter_hello_proto_rawDescData = file_test_reenter_hello_proto_rawDesc ) -func file_testdata_reenter_hello_proto_rawDescGZIP() []byte { - file_testdata_reenter_hello_proto_rawDescOnce.Do(func() { - file_testdata_reenter_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_testdata_reenter_hello_proto_rawDescData) +func file_test_reenter_hello_proto_rawDescGZIP() []byte { + file_test_reenter_hello_proto_rawDescOnce.Do(func() { + file_test_reenter_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_reenter_hello_proto_rawDescData) }) - return file_testdata_reenter_hello_proto_rawDescData + return file_test_reenter_hello_proto_rawDescData } -var file_testdata_reenter_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_testdata_reenter_hello_proto_goTypes = []interface{}{ +var file_test_reenter_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_test_reenter_hello_proto_goTypes = []interface{}{ (*SayHelloRequest)(nil), // 0: hello.SayHelloRequest (*SayHelloResponse)(nil), // 1: hello.SayHelloResponse (*DoworkRequest)(nil), // 2: hello.DoworkRequest (*DoworkResponse)(nil), // 3: hello.DoworkResponse } -var file_testdata_reenter_hello_proto_depIdxs = []int32{ +var file_test_reenter_hello_proto_depIdxs = []int32{ 0, // 0: hello.Hello.SayHello:input_type -> hello.SayHelloRequest 2, // 1: hello.Hello.Dowork:input_type -> hello.DoworkRequest 1, // 2: hello.Hello.SayHello:output_type -> hello.SayHelloResponse @@ -275,13 +275,13 @@ var file_testdata_reenter_hello_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_testdata_reenter_hello_proto_init() } -func file_testdata_reenter_hello_proto_init() { - if File_testdata_reenter_hello_proto != nil { +func init() { file_test_reenter_hello_proto_init() } +func file_test_reenter_hello_proto_init() { + if File_test_reenter_hello_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_testdata_reenter_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_test_reenter_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SayHelloRequest); i { case 0: return &v.state @@ -293,7 +293,7 @@ func file_testdata_reenter_hello_proto_init() { return nil } } - file_testdata_reenter_hello_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_test_reenter_hello_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SayHelloResponse); i { case 0: return &v.state @@ -305,7 +305,7 @@ func file_testdata_reenter_hello_proto_init() { return nil } } - file_testdata_reenter_hello_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_test_reenter_hello_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DoworkRequest); i { case 0: return &v.state @@ -317,7 +317,7 @@ func file_testdata_reenter_hello_proto_init() { return nil } } - file_testdata_reenter_hello_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_test_reenter_hello_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DoworkResponse); i { case 0: return &v.state @@ -334,18 +334,18 @@ func file_testdata_reenter_hello_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testdata_reenter_hello_proto_rawDesc, + RawDescriptor: file_test_reenter_hello_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_testdata_reenter_hello_proto_goTypes, - DependencyIndexes: file_testdata_reenter_hello_proto_depIdxs, - MessageInfos: file_testdata_reenter_hello_proto_msgTypes, + GoTypes: file_test_reenter_hello_proto_goTypes, + DependencyIndexes: file_test_reenter_hello_proto_depIdxs, + MessageInfos: file_test_reenter_hello_proto_msgTypes, }.Build() - File_testdata_reenter_hello_proto = out.File - file_testdata_reenter_hello_proto_rawDesc = nil - file_testdata_reenter_hello_proto_goTypes = nil - file_testdata_reenter_hello_proto_depIdxs = nil + File_test_reenter_hello_proto = out.File + file_test_reenter_hello_proto_rawDesc = nil + file_test_reenter_hello_proto_goTypes = nil + file_test_reenter_hello_proto_depIdxs = nil } diff --git a/protobuf/protoc-gen-go-grain/testdata/reenter/hello.proto b/protobuf/protoc-gen-go-grain/test/reenter/hello.proto similarity index 100% rename from protobuf/protoc-gen-go-grain/testdata/reenter/hello.proto rename to protobuf/protoc-gen-go-grain/test/reenter/hello.proto diff --git a/protobuf/protoc-gen-go-grain/testdata/reenter/hello_grain.pb.go b/protobuf/protoc-gen-go-grain/test/reenter/hello_grain.pb.go similarity index 98% rename from protobuf/protoc-gen-go-grain/testdata/reenter/hello_grain.pb.go rename to protobuf/protoc-gen-go-grain/test/reenter/hello_grain.pb.go index 3d14e505..c79f61eb 100644 --- a/protobuf/protoc-gen-go-grain/testdata/reenter/hello_grain.pb.go +++ b/protobuf/protoc-gen-go-grain/test/reenter/hello_grain.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-grain. DO NOT EDIT. // versions: -// protoc-gen-grain v0.5.0 +// protoc-gen-grain v0.6.0 // protoc v4.25.0 -// source: testdata/reenter/hello.proto +// source: test/reenter/hello.proto package hello diff --git a/protobuf/protoc-gen-go-grain/testdata/error/hello.pb.go b/protobuf/protoc-gen-go-grain/testdata/error/hello.pb.go deleted file mode 100644 index 94389bc0..00000000 --- a/protobuf/protoc-gen-go-grain/testdata/error/hello.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.0 -// source: testdata/error/hello.proto - -package hello - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ErrorReason int32 - -const ( - ErrorReason_USER_NOT_FOUND ErrorReason = 0 - ErrorReason_CONTENT_MISSING ErrorReason = 1 -) - -// Enum value maps for ErrorReason. -var ( - ErrorReason_name = map[int32]string{ - 0: "USER_NOT_FOUND", - 1: "CONTENT_MISSING", - } - ErrorReason_value = map[string]int32{ - "USER_NOT_FOUND": 0, - "CONTENT_MISSING": 1, - } -) - -func (x ErrorReason) Enum() *ErrorReason { - p := new(ErrorReason) - *p = x - return p -} - -func (x ErrorReason) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ErrorReason) Descriptor() protoreflect.EnumDescriptor { - return file_testdata_error_hello_proto_enumTypes[0].Descriptor() -} - -func (ErrorReason) Type() protoreflect.EnumType { - return &file_testdata_error_hello_proto_enumTypes[0] -} - -func (x ErrorReason) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ErrorReason.Descriptor instead. -func (ErrorReason) EnumDescriptor() ([]byte, []int) { - return file_testdata_error_hello_proto_rawDescGZIP(), []int{0} -} - -type SayHelloResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *SayHelloResponse) Reset() { - *x = SayHelloResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_testdata_error_hello_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SayHelloResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SayHelloResponse) ProtoMessage() {} - -func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_error_hello_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead. -func (*SayHelloResponse) Descriptor() ([]byte, []int) { - return file_testdata_error_hello_proto_rawDescGZIP(), []int{0} -} - -func (x *SayHelloResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -var File_testdata_error_hello_proto protoreflect.FileDescriptor - -var file_testdata_error_hello_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, - 0x6c, 0x6c, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x2c, 0x0a, 0x10, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x36, - 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x12, 0x0a, - 0x0e, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, - 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x54, 0x5f, 0x4d, 0x49, 0x53, - 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x32, 0x46, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, - 0x3d, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x46, - 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, - 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, - 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, - 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, - 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_testdata_error_hello_proto_rawDescOnce sync.Once - file_testdata_error_hello_proto_rawDescData = file_testdata_error_hello_proto_rawDesc -) - -func file_testdata_error_hello_proto_rawDescGZIP() []byte { - file_testdata_error_hello_proto_rawDescOnce.Do(func() { - file_testdata_error_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_testdata_error_hello_proto_rawDescData) - }) - return file_testdata_error_hello_proto_rawDescData -} - -var file_testdata_error_hello_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_testdata_error_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_testdata_error_hello_proto_goTypes = []interface{}{ - (ErrorReason)(0), // 0: hello.ErrorReason - (*SayHelloResponse)(nil), // 1: hello.SayHelloResponse - (*emptypb.Empty)(nil), // 2: google.protobuf.Empty -} -var file_testdata_error_hello_proto_depIdxs = []int32{ - 2, // 0: hello.Hello.SayHello:input_type -> google.protobuf.Empty - 1, // 1: hello.Hello.SayHello:output_type -> hello.SayHelloResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] 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 extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_testdata_error_hello_proto_init() } -func file_testdata_error_hello_proto_init() { - if File_testdata_error_hello_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_testdata_error_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SayHelloResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testdata_error_hello_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_testdata_error_hello_proto_goTypes, - DependencyIndexes: file_testdata_error_hello_proto_depIdxs, - EnumInfos: file_testdata_error_hello_proto_enumTypes, - MessageInfos: file_testdata_error_hello_proto_msgTypes, - }.Build() - File_testdata_error_hello_proto = out.File - file_testdata_error_hello_proto_rawDesc = nil - file_testdata_error_hello_proto_goTypes = nil - file_testdata_error_hello_proto_depIdxs = nil -} diff --git a/protobuf/protoc-gen-go-grain/testdata/error/hello_grain.pb.go b/protobuf/protoc-gen-go-grain/testdata/error/hello_grain.pb.go deleted file mode 100644 index cd6966ea..00000000 --- a/protobuf/protoc-gen-go-grain/testdata/error/hello_grain.pb.go +++ /dev/null @@ -1,187 +0,0 @@ -// Code generated by protoc-gen-grain. DO NOT EDIT. -// versions: -// protoc-gen-grain v0.5.0 -// protoc v4.25.0 -// source: testdata/error/hello.proto - -package hello - -import ( - fmt "fmt" - actor "github.com/asynkron/protoactor-go/actor" - cluster "github.com/asynkron/protoactor-go/cluster" - proto "google.golang.org/protobuf/proto" - emptypb "google.golang.org/protobuf/types/known/emptypb" - slog "log/slog" - time "time" -) - -func ErrUserNotFound(format string, args ...interface{}) *cluster.GrainErrorResponse { - return cluster.NewGrainErrorResponse(ErrorReason_USER_NOT_FOUND.String(), fmt.Sprintf(format, args...)) -} - -func IsUserNotFound(err error) bool { - if err == nil { - return false - } - e := cluster.FromError(err) - return e.Reason == ErrorReason_USER_NOT_FOUND.String() -} - -func ErrContentMissing(format string, args ...interface{}) *cluster.GrainErrorResponse { - return cluster.NewGrainErrorResponse(ErrorReason_CONTENT_MISSING.String(), fmt.Sprintf(format, args...)) -} - -func IsContentMissing(err error) bool { - if err == nil { - return false - } - e := cluster.FromError(err) - return e.Reason == ErrorReason_CONTENT_MISSING.String() -} - -var xHelloFactory func() Hello - -// HelloFactory produces a Hello -func HelloFactory(factory func() Hello) { - xHelloFactory = factory -} - -// GetHelloGrainClient instantiates a new HelloGrainClient with given Identity -func GetHelloGrainClient(c *cluster.Cluster, id string) *HelloGrainClient { - if c == nil { - panic(fmt.Errorf("nil cluster instance")) - } - if id == "" { - panic(fmt.Errorf("empty id")) - } - return &HelloGrainClient{Identity: id, cluster: c} -} - -// GetHelloKind instantiates a new cluster.Kind for Hello -func GetHelloKind(opts ...actor.PropsOption) *cluster.Kind { - props := actor.PropsFromProducer(func() actor.Actor { - return &HelloActor{ - Timeout: 60 * time.Second, - } - }, opts...) - kind := cluster.NewKind("Hello", props) - return kind -} - -// GetHelloKind instantiates a new cluster.Kind for Hello -func NewHelloKind(factory func() Hello, timeout time.Duration, opts ...actor.PropsOption) *cluster.Kind { - xHelloFactory = factory - props := actor.PropsFromProducer(func() actor.Actor { - return &HelloActor{ - Timeout: timeout, - } - }, opts...) - kind := cluster.NewKind("Hello", props) - return kind -} - -// Hello interfaces the services available to the Hello -type Hello interface { - Init(ctx cluster.GrainContext) - Terminate(ctx cluster.GrainContext) - ReceiveDefault(ctx cluster.GrainContext) - SayHello(req *emptypb.Empty, ctx cluster.GrainContext) (*SayHelloResponse, error) -} - -// HelloGrainClient holds the base data for the HelloGrain -type HelloGrainClient struct { - Identity string - cluster *cluster.Cluster -} - -// SayHello requests the execution on to the cluster with CallOptions -func (g *HelloGrainClient) SayHello(r *emptypb.Empty, opts ...cluster.GrainCallOption) (*SayHelloResponse, error) { - bytes, err := proto.Marshal(r) - if err != nil { - return nil, err - } - reqMsg := &cluster.GrainRequest{MethodIndex: 0, MessageData: bytes} - resp, err := g.cluster.Request(g.Identity, "Hello", reqMsg, opts...) - if err != nil { - return nil, fmt.Errorf("error request: %w", err) - } - switch msg := resp.(type) { - case *SayHelloResponse: - return msg, nil - case *cluster.GrainErrorResponse: - if msg == nil { - return nil, nil - } - return nil, msg - default: - return nil, fmt.Errorf("unknown response type %T", resp) - } -} - -// HelloActor represents the actor structure -type HelloActor struct { - ctx cluster.GrainContext - inner Hello - Timeout time.Duration -} - -// Receive ensures the lifecycle of the actor for the received message -func (a *HelloActor) Receive(ctx actor.Context) { - switch msg := ctx.Message().(type) { - case *actor.Started: //pass - case *cluster.ClusterInit: - a.ctx = cluster.NewGrainContext(ctx, msg.Identity, msg.Cluster) - a.inner = xHelloFactory() - a.inner.Init(a.ctx) - - if a.Timeout > 0 { - ctx.SetReceiveTimeout(a.Timeout) - } - case *actor.ReceiveTimeout: - ctx.Poison(ctx.Self()) - case *actor.Stopped: - a.inner.Terminate(a.ctx) - case actor.AutoReceiveMessage: // pass - case actor.SystemMessage: // pass - - case *cluster.GrainRequest: - switch msg.MethodIndex { - case 0: - req := &emptypb.Empty{} - err := proto.Unmarshal(msg.MessageData, req) - if err != nil { - ctx.Logger().Error("[Grain] SayHello(emptypb.Empty) proto.Unmarshal failed.", slog.Any("error", err)) - resp := cluster.NewGrainErrorResponse(cluster.ErrorReason_INVALID_ARGUMENT, err.Error()). - WithMetadata(map[string]string{ - "argument": req.String(), - }) - ctx.Respond(resp) - return - } - - r0, err := a.inner.SayHello(req, a.ctx) - if err != nil { - resp := cluster.FromError(err) - ctx.Respond(resp) - return - } - ctx.Respond(r0) - } - default: - a.inner.ReceiveDefault(a.ctx) - } -} - -// onError should be used in ctx.ReenterAfter -// you can just return error in reenterable method for other errors -func (a *HelloActor) onError(err error) { - resp := cluster.FromError(err) - a.ctx.Respond(resp) -} - -func respond[T proto.Message](ctx cluster.GrainContext) func(T) { - return func(resp T) { - ctx.Respond(resp) - } -} diff --git a/protobuf/protoc-gen-go-grain/testdata/hello/hello.pb.go b/protobuf/protoc-gen-go-grain/testdata/hello/hello.pb.go deleted file mode 100644 index 3656fee2..00000000 --- a/protobuf/protoc-gen-go-grain/testdata/hello/hello.pb.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.0 -// source: testdata/hello/hello.proto - -package hello - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type SayHelloResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *SayHelloResponse) Reset() { - *x = SayHelloResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_testdata_hello_hello_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SayHelloResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SayHelloResponse) ProtoMessage() {} - -func (x *SayHelloResponse) ProtoReflect() protoreflect.Message { - mi := &file_testdata_hello_hello_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead. -func (*SayHelloResponse) Descriptor() ([]byte, []int) { - return file_testdata_hello_hello_proto_rawDescGZIP(), []int{0} -} - -func (x *SayHelloResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -var File_testdata_hello_hello_proto protoreflect.FileDescriptor - -var file_testdata_hello_hello_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, - 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x68, 0x65, - 0x6c, 0x6c, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x2c, 0x0a, 0x10, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x46, - 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x3d, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, - 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x68, 0x65, - 0x6c, 0x6c, 0x6f, 0x2e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x6b, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_testdata_hello_hello_proto_rawDescOnce sync.Once - file_testdata_hello_hello_proto_rawDescData = file_testdata_hello_hello_proto_rawDesc -) - -func file_testdata_hello_hello_proto_rawDescGZIP() []byte { - file_testdata_hello_hello_proto_rawDescOnce.Do(func() { - file_testdata_hello_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_testdata_hello_hello_proto_rawDescData) - }) - return file_testdata_hello_hello_proto_rawDescData -} - -var file_testdata_hello_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_testdata_hello_hello_proto_goTypes = []interface{}{ - (*SayHelloResponse)(nil), // 0: hello.SayHelloResponse - (*emptypb.Empty)(nil), // 1: google.protobuf.Empty -} -var file_testdata_hello_hello_proto_depIdxs = []int32{ - 1, // 0: hello.Hello.SayHello:input_type -> google.protobuf.Empty - 0, // 1: hello.Hello.SayHello:output_type -> hello.SayHelloResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] 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 extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_testdata_hello_hello_proto_init() } -func file_testdata_hello_hello_proto_init() { - if File_testdata_hello_hello_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_testdata_hello_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SayHelloResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testdata_hello_hello_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_testdata_hello_hello_proto_goTypes, - DependencyIndexes: file_testdata_hello_hello_proto_depIdxs, - MessageInfos: file_testdata_hello_hello_proto_msgTypes, - }.Build() - File_testdata_hello_hello_proto = out.File - file_testdata_hello_hello_proto_rawDesc = nil - file_testdata_hello_hello_proto_goTypes = nil - file_testdata_hello_hello_proto_depIdxs = nil -} diff --git a/protobuf/protoc-gen-go-grain/version.go b/protobuf/protoc-gen-go-grain/version.go index 0454b2c7..5538d45a 100644 --- a/protobuf/protoc-gen-go-grain/version.go +++ b/protobuf/protoc-gen-go-grain/version.go @@ -1,3 +1,3 @@ package main -const version = "v0.5.1" +const version = "v0.6.1"