From 469eb8aa5829ce63f73f0cb039f0dbd95e2bb9ff Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 15:44:19 +0300 Subject: [PATCH 1/6] [2.6] add feature ignoreArrayOrder --- api/openapi/api.yaml | 3 + example/simple/client/main.go | 13 ++ example/simple/simple.proto | 1 + example/simple/stub/strict.yml | 32 +++++ go.mod | 8 +- go.sum | 35 ++--- internal/app/storage.go | 59 ++++++-- internal/domain/rest/api.gen.go | 7 +- pkg/sdk/api.gen.go | 7 +- pkg/storage/stubs.go | 7 +- protoc-gen-gripmock/go.mod | 6 +- protoc-gen-gripmock/go.sum | 18 +-- protogen/example/multi-files/file1.pb.go | 102 ++++++------- protogen/example/multi-files/file1_grpc.pb.go | 6 +- protogen/example/multi-files/file2.pb.go | 102 ++++++------- protogen/example/multi-files/file2_grpc.pb.go | 6 +- protogen/example/multi-package/bar/bar.pb.go | 79 ++++++----- protogen/example/multi-package/foo.pb.go | 76 +++++----- protogen/example/one-of/oneof.pb.go | 134 +++++++++--------- protogen/example/one-of/oneof_grpc.pb.go | 6 +- protogen/example/simple/simple.pb.go | 124 ++++++++-------- protogen/example/simple/simple_grpc.pb.go | 6 +- protogen/example/stream/stream.pb.go | 108 +++++++------- protogen/example/stream/stream_grpc.pb.go | 6 +- protogen/go.mod | 8 +- protogen/go.sum | 26 ++-- 26 files changed, 527 insertions(+), 458 deletions(-) create mode 100644 example/simple/stub/strict.yml diff --git a/api/openapi/api.yaml b/api/openapi/api.yaml index d93a3ae3..8744f91f 100644 --- a/api/openapi/api.yaml +++ b/api/openapi/api.yaml @@ -272,6 +272,9 @@ components: StubInput: type: object properties: + ignoreArrayOrder: + type: boolean + default: false equals: type: object additionalProperties: true diff --git a/example/simple/client/main.go b/example/simple/client/main.go index be26fb5f..777cb006 100644 --- a/example/simple/client/main.go +++ b/example/simple/client/main.go @@ -193,4 +193,17 @@ func main() { log.Fatalf("expected: 18446744073709551615, received: %d", r.Vuint64) } log.Printf("Greeting: %s (return code %d)", r.Message, r.ReturnCode) + + // ignoreArrayOrder=false + r, err = c.SayHello(context.Background(), &pb.Request{Values: []int64{1, 2, 3, 4, 5, 6}}) + if err == nil { + log.Fatal("error it is expected that there will be no stubs") + } + + // ignoreArrayOrder=true + r, err = c.SayHello(context.Background(), &pb.Request{Values: []int64{10, 20, 30, 40, 50, 60, 70}}) + if err != nil { + log.Fatalf("error from grpc: %v", err) + } + log.Printf("Greeting: %s (return code %d)", r.Message, r.ReturnCode) } diff --git a/example/simple/simple.proto b/example/simple/simple.proto index cff540c1..0b01dd80 100644 --- a/example/simple/simple.proto +++ b/example/simple/simple.proto @@ -15,6 +15,7 @@ message Request { string name = 1; int64 vint64 = 2; uint64 vuint64 = 3; + repeated int64 values = 4; } // The response message containing the greetings diff --git a/example/simple/stub/strict.yml b/example/simple/stub/strict.yml new file mode 100644 index 00000000..217b7b86 --- /dev/null +++ b/example/simple/stub/strict.yml @@ -0,0 +1,32 @@ +--- +- service: Gripmock + method: SayHello + input: + equals: + values: + - 1 + - 2 + - 3 + - 6 + - 5 + - 4 + output: + data: + message: "6. strict mode" + +- service: Gripmock + method: SayHello + input: + ignoreArrayOrder: true + equals: + values: + - 10 + - 20 + - 30 + - 60 + - 50 + - 40 + - 70 + output: + data: + message: "7. strict mode" diff --git a/go.mod b/go.mod index 366b0a39..4de2e835 100644 --- a/go.mod +++ b/go.mod @@ -45,12 +45,12 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 53cc383c..37a6fcf8 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,6 @@ github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -49,8 +47,6 @@ github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -124,19 +120,18 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -149,8 +144,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -173,18 +166,12 @@ golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSm golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= -google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 h1:/IWabOtPziuXTEtI1KYCpM6Ss7vaAkeMxk+uXV/xvZs= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 h1:OPXtXn7fNMaXwO3JvOmF1QyTc00jsSFFz1vXXBOdCDo= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/internal/app/storage.go b/internal/app/storage.go index 8889a007..03a5b75a 100644 --- a/internal/app/storage.go +++ b/internal/app/storage.go @@ -90,7 +90,7 @@ func inputCmp(input storage.Input, data map[string]interface{}) (*closeMatch, er if expect := input.Equals; expect != nil { closeMatchVal := closeMatch{rule: "equals", expect: expect} - if equals(input.Equals, data) { + if equals(input.Equals, data, input.IgnoreArrayOrder) { return &closeMatchVal, nil } @@ -100,7 +100,7 @@ func inputCmp(input storage.Input, data map[string]interface{}) (*closeMatch, er if expect := input.Contains; expect != nil { closeMatchVal := closeMatch{rule: "contains", expect: expect} - if contains(input.Contains, data) { + if contains(input.Contains, data, input.IgnoreArrayOrder) { return &closeMatchVal, nil } @@ -110,7 +110,7 @@ func inputCmp(input storage.Input, data map[string]interface{}) (*closeMatch, er if expect := input.Matches; expect != nil { closeMatchVal := closeMatch{rule: "matches", expect: expect} - if matches(input.Matches, data) { + if matches(input.Matches, data, input.IgnoreArrayOrder) { return &closeMatchVal, nil } @@ -211,20 +211,20 @@ func regexMatch(expect, actual interface{}) bool { return reflect.DeepEqual(expect, actual) } -func equals(expect, actual map[string]interface{}) bool { - return find(expect, actual, true, true, reflect.DeepEqual) +func equals(expect, actual map[string]interface{}, ignoreArrayOrder bool) bool { + return find(expect, actual, true, true, reflect.DeepEqual, ignoreArrayOrder) } -func contains(expect, actual map[string]interface{}) bool { - return find(expect, actual, true, false, reflect.DeepEqual) +func contains(expect, actual map[string]interface{}, ignoreArrayOrder bool) bool { + return find(expect, actual, true, false, reflect.DeepEqual, ignoreArrayOrder) } -func matches(expect, actual map[string]interface{}) bool { - return find(expect, actual, true, false, regexMatch) +func matches(expect, actual map[string]interface{}, ignoreArrayOrder bool) bool { + return find(expect, actual, true, false, regexMatch, ignoreArrayOrder) } //nolint:cyclop -func find(expect, actual interface{}, acc, exactMatch bool, f matchFunc) bool { +func find(expect, actual interface{}, acc, exactMatch bool, f matchFunc, ignoreArrayOrder bool) bool { // circuit brake if !acc { return false @@ -245,9 +245,13 @@ func find(expect, actual interface{}, acc, exactMatch bool, f matchFunc) bool { return false } + if ignoreArrayOrder { + return cmpValue(expectArrayValue, actualArrayValue, f) + } + for expectItemIndex, expectItemValue := range expectArrayValue { actualItemValue := actualArrayValue[expectItemIndex] - acc = find(expectItemValue, actualItemValue, acc, exactMatch, f) + acc = find(expectItemValue, actualItemValue, acc, exactMatch, f, ignoreArrayOrder) } return acc @@ -270,7 +274,7 @@ func find(expect, actual interface{}, acc, exactMatch bool, f matchFunc) bool { for expectItemKey, expectItemValue := range expectMapValue { actualItemValue := actualMapValue[expectItemKey] - acc = find(expectItemValue, actualItemValue, acc, exactMatch, f) + acc = find(expectItemValue, actualItemValue, acc, exactMatch, f, ignoreArrayOrder) } return acc @@ -278,3 +282,34 @@ func find(expect, actual interface{}, acc, exactMatch bool, f matchFunc) bool { return f(expect, actual) } + +func cmpValue(a, b []interface{}, f matchFunc) bool { + if len(a) != len(b) { + return false + } + + if f(a, b) { + return true + } + + d := len(a) + c := make([]interface{}, 0, d) + + for i := 0; i < d; i++ { + for ia, va := range a { + for ib, vb := range b { + if f(va, vb) { + c = append(c, va) + a = remove(a, ia) + b = remove(b, ib) + } + } + } + } + + return d == len(c) +} + +func remove(s []interface{}, i int) []interface{} { + return append(s[:i], s[i+1:]...) +} diff --git a/internal/domain/rest/api.gen.go b/internal/domain/rest/api.gen.go index 08723c40..7059df10 100644 --- a/internal/domain/rest/api.gen.go +++ b/internal/domain/rest/api.gen.go @@ -63,9 +63,10 @@ type StubHeaders struct { // StubInput defines model for StubInput. type StubInput struct { - Contains map[string]interface{} `json:"contains,omitempty"` - Equals map[string]interface{} `json:"equals,omitempty"` - Matches map[string]interface{} `json:"matches,omitempty"` + Contains map[string]interface{} `json:"contains,omitempty"` + Equals map[string]interface{} `json:"equals,omitempty"` + IgnoreArrayOrder *bool `json:"ignoreArrayOrder,omitempty"` + Matches map[string]interface{} `json:"matches,omitempty"` } // StubList defines model for StubList. diff --git a/pkg/sdk/api.gen.go b/pkg/sdk/api.gen.go index 0f64e17a..63acddb4 100644 --- a/pkg/sdk/api.gen.go +++ b/pkg/sdk/api.gen.go @@ -67,9 +67,10 @@ type StubHeaders struct { // StubInput defines model for StubInput. type StubInput struct { - Contains map[string]interface{} `json:"contains,omitempty"` - Equals map[string]interface{} `json:"equals,omitempty"` - Matches map[string]interface{} `json:"matches,omitempty"` + Contains map[string]interface{} `json:"contains,omitempty"` + Equals map[string]interface{} `json:"equals,omitempty"` + IgnoreArrayOrder *bool `json:"ignoreArrayOrder,omitempty"` + Matches map[string]interface{} `json:"matches,omitempty"` } // StubList defines model for StubList. diff --git a/pkg/storage/stubs.go b/pkg/storage/stubs.go index 03f5624e..3852870a 100644 --- a/pkg/storage/stubs.go +++ b/pkg/storage/stubs.go @@ -35,9 +35,10 @@ func (s *Stub) GetID() uuid.UUID { } type Input struct { - Equals map[string]interface{} `json:"equals"` - Contains map[string]interface{} `json:"contains"` - Matches map[string]interface{} `json:"matches"` + IgnoreArrayOrder bool `json:"ignoreArrayOrder"` + Equals map[string]interface{} `json:"equals"` + Contains map[string]interface{} `json:"contains"` + Matches map[string]interface{} `json:"matches"` } type Output struct { diff --git a/protoc-gen-gripmock/go.mod b/protoc-gen-gripmock/go.mod index def8d1d3..cd70f3d4 100644 --- a/protoc-gen-gripmock/go.mod +++ b/protoc-gen-gripmock/go.mod @@ -6,7 +6,7 @@ require ( go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 golang.org/x/text v0.14.0 - golang.org/x/tools v0.16.1 + golang.org/x/tools v0.17.0 google.golang.org/protobuf v1.32.0 ) @@ -19,8 +19,8 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/sys v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect google.golang.org/grpc v1.60.1 // indirect ) diff --git a/protoc-gen-gripmock/go.sum b/protoc-gen-gripmock/go.sum index f1ab9f4b..e98206eb 100644 --- a/protoc-gen-gripmock/go.sum +++ b/protoc-gen-gripmock/go.sum @@ -11,8 +11,6 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7 github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -39,25 +37,21 @@ go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8 go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/protogen/example/multi-files/file1.pb.go b/protogen/example/multi-files/file1.pb.go index ea8431f5..75f71a4d 100644 --- a/protogen/example/multi-files/file1.pb.go +++ b/protogen/example/multi-files/file1.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: file1.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: multi-files/file1.proto package multi_files @@ -32,7 +32,7 @@ type Request1 struct { func (x *Request1) Reset() { *x = Request1{} if protoimpl.UnsafeEnabled { - mi := &file_file1_proto_msgTypes[0] + mi := &file_multi_files_file1_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request1) String() string { func (*Request1) ProtoMessage() {} func (x *Request1) ProtoReflect() protoreflect.Message { - mi := &file_file1_proto_msgTypes[0] + mi := &file_multi_files_file1_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 *Request1) ProtoReflect() protoreflect.Message { // Deprecated: Use Request1.ProtoReflect.Descriptor instead. func (*Request1) Descriptor() ([]byte, []int) { - return file_file1_proto_rawDescGZIP(), []int{0} + return file_multi_files_file1_proto_rawDescGZIP(), []int{0} } func (x *Request1) GetName() string { @@ -81,7 +81,7 @@ type Reply1 struct { func (x *Reply1) Reset() { *x = Reply1{} if protoimpl.UnsafeEnabled { - mi := &file_file1_proto_msgTypes[1] + mi := &file_multi_files_file1_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *Reply1) String() string { func (*Reply1) ProtoMessage() {} func (x *Reply1) ProtoReflect() protoreflect.Message { - mi := &file_file1_proto_msgTypes[1] + mi := &file_multi_files_file1_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *Reply1) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply1.ProtoReflect.Descriptor instead. func (*Reply1) Descriptor() ([]byte, []int) { - return file_file1_proto_rawDescGZIP(), []int{1} + return file_multi_files_file1_proto_rawDescGZIP(), []int{1} } func (x *Reply1) GetMessage() string { @@ -124,46 +124,46 @@ func (x *Reply1) GetReturnCode() int32 { return 0 } -var File_file1_proto protoreflect.FileDescriptor - -var file_file1_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, - 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, - 0x0a, 0x09, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x31, 0x12, 0x34, 0x0a, 0x08, 0x53, - 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x31, 0x1a, 0x12, 0x2e, - 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x31, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, - 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_multi_files_file1_proto protoreflect.FileDescriptor + +var file_multi_files_file1_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, + 0x6c, 0x65, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, 0x0a, 0x09, 0x47, 0x72, + 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x31, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x31, 0x1a, 0x12, 0x2e, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x42, 0x2f, 0x5a, + 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_file1_proto_rawDescOnce sync.Once - file_file1_proto_rawDescData = file_file1_proto_rawDesc + file_multi_files_file1_proto_rawDescOnce sync.Once + file_multi_files_file1_proto_rawDescData = file_multi_files_file1_proto_rawDesc ) -func file_file1_proto_rawDescGZIP() []byte { - file_file1_proto_rawDescOnce.Do(func() { - file_file1_proto_rawDescData = protoimpl.X.CompressGZIP(file_file1_proto_rawDescData) +func file_multi_files_file1_proto_rawDescGZIP() []byte { + file_multi_files_file1_proto_rawDescOnce.Do(func() { + file_multi_files_file1_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_files_file1_proto_rawDescData) }) - return file_file1_proto_rawDescData + return file_multi_files_file1_proto_rawDescData } -var file_file1_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_file1_proto_goTypes = []interface{}{ +var file_multi_files_file1_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_multi_files_file1_proto_goTypes = []interface{}{ (*Request1)(nil), // 0: multifiles.Request1 (*Reply1)(nil), // 1: multifiles.Reply1 } -var file_file1_proto_depIdxs = []int32{ +var file_multi_files_file1_proto_depIdxs = []int32{ 0, // 0: multifiles.Gripmock1.SayHello:input_type -> multifiles.Request1 1, // 1: multifiles.Gripmock1.SayHello:output_type -> multifiles.Reply1 1, // [1:2] is the sub-list for method output_type @@ -173,13 +173,13 @@ var file_file1_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_file1_proto_init() } -func file_file1_proto_init() { - if File_file1_proto != nil { +func init() { file_multi_files_file1_proto_init() } +func file_multi_files_file1_proto_init() { + if File_multi_files_file1_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_file1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_multi_files_file1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request1); i { case 0: return &v.state @@ -191,7 +191,7 @@ func file_file1_proto_init() { return nil } } - file_file1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_multi_files_file1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply1); i { case 0: return &v.state @@ -208,18 +208,18 @@ func file_file1_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_file1_proto_rawDesc, + RawDescriptor: file_multi_files_file1_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_file1_proto_goTypes, - DependencyIndexes: file_file1_proto_depIdxs, - MessageInfos: file_file1_proto_msgTypes, + GoTypes: file_multi_files_file1_proto_goTypes, + DependencyIndexes: file_multi_files_file1_proto_depIdxs, + MessageInfos: file_multi_files_file1_proto_msgTypes, }.Build() - File_file1_proto = out.File - file_file1_proto_rawDesc = nil - file_file1_proto_goTypes = nil - file_file1_proto_depIdxs = nil + File_multi_files_file1_proto = out.File + file_multi_files_file1_proto_rawDesc = nil + file_multi_files_file1_proto_goTypes = nil + file_multi_files_file1_proto_depIdxs = nil } diff --git a/protogen/example/multi-files/file1_grpc.pb.go b/protogen/example/multi-files/file1_grpc.pb.go index faa71d0f..c03c8cee 100644 --- a/protogen/example/multi-files/file1_grpc.pb.go +++ b/protogen/example/multi-files/file1_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: file1.proto +// - protoc v4.25.1 +// source: multi-files/file1.proto package multi_files @@ -107,5 +107,5 @@ var Gripmock1_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "file1.proto", + Metadata: "multi-files/file1.proto", } diff --git a/protogen/example/multi-files/file2.pb.go b/protogen/example/multi-files/file2.pb.go index a0cb8e3a..10675b42 100644 --- a/protogen/example/multi-files/file2.pb.go +++ b/protogen/example/multi-files/file2.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: file2.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: multi-files/file2.proto package multi_files @@ -32,7 +32,7 @@ type Request2 struct { func (x *Request2) Reset() { *x = Request2{} if protoimpl.UnsafeEnabled { - mi := &file_file2_proto_msgTypes[0] + mi := &file_multi_files_file2_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request2) String() string { func (*Request2) ProtoMessage() {} func (x *Request2) ProtoReflect() protoreflect.Message { - mi := &file_file2_proto_msgTypes[0] + mi := &file_multi_files_file2_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 *Request2) ProtoReflect() protoreflect.Message { // Deprecated: Use Request2.ProtoReflect.Descriptor instead. func (*Request2) Descriptor() ([]byte, []int) { - return file_file2_proto_rawDescGZIP(), []int{0} + return file_multi_files_file2_proto_rawDescGZIP(), []int{0} } func (x *Request2) GetName() string { @@ -81,7 +81,7 @@ type Reply2 struct { func (x *Reply2) Reset() { *x = Reply2{} if protoimpl.UnsafeEnabled { - mi := &file_file2_proto_msgTypes[1] + mi := &file_multi_files_file2_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *Reply2) String() string { func (*Reply2) ProtoMessage() {} func (x *Reply2) ProtoReflect() protoreflect.Message { - mi := &file_file2_proto_msgTypes[1] + mi := &file_multi_files_file2_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *Reply2) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply2.ProtoReflect.Descriptor instead. func (*Reply2) Descriptor() ([]byte, []int) { - return file_file2_proto_rawDescGZIP(), []int{1} + return file_multi_files_file2_proto_rawDescGZIP(), []int{1} } func (x *Reply2) GetMessage() string { @@ -124,46 +124,46 @@ func (x *Reply2) GetReturnCode() int32 { return 0 } -var File_file2_proto protoreflect.FileDescriptor - -var file_file2_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x32, 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, 0x12, 0x1f, 0x0a, - 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, - 0x0a, 0x09, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x32, 0x12, 0x34, 0x0a, 0x08, 0x53, - 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x1a, 0x12, 0x2e, - 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x32, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, - 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_multi_files_file2_proto protoreflect.FileDescriptor + +var file_multi_files_file2_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, + 0x6c, 0x65, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x32, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, 0x0a, 0x09, 0x47, 0x72, + 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x32, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x1a, 0x12, 0x2e, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x2f, 0x5a, + 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_file2_proto_rawDescOnce sync.Once - file_file2_proto_rawDescData = file_file2_proto_rawDesc + file_multi_files_file2_proto_rawDescOnce sync.Once + file_multi_files_file2_proto_rawDescData = file_multi_files_file2_proto_rawDesc ) -func file_file2_proto_rawDescGZIP() []byte { - file_file2_proto_rawDescOnce.Do(func() { - file_file2_proto_rawDescData = protoimpl.X.CompressGZIP(file_file2_proto_rawDescData) +func file_multi_files_file2_proto_rawDescGZIP() []byte { + file_multi_files_file2_proto_rawDescOnce.Do(func() { + file_multi_files_file2_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_files_file2_proto_rawDescData) }) - return file_file2_proto_rawDescData + return file_multi_files_file2_proto_rawDescData } -var file_file2_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_file2_proto_goTypes = []interface{}{ +var file_multi_files_file2_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_multi_files_file2_proto_goTypes = []interface{}{ (*Request2)(nil), // 0: multifiles.Request2 (*Reply2)(nil), // 1: multifiles.Reply2 } -var file_file2_proto_depIdxs = []int32{ +var file_multi_files_file2_proto_depIdxs = []int32{ 0, // 0: multifiles.Gripmock2.SayHello:input_type -> multifiles.Request2 1, // 1: multifiles.Gripmock2.SayHello:output_type -> multifiles.Reply2 1, // [1:2] is the sub-list for method output_type @@ -173,13 +173,13 @@ var file_file2_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_file2_proto_init() } -func file_file2_proto_init() { - if File_file2_proto != nil { +func init() { file_multi_files_file2_proto_init() } +func file_multi_files_file2_proto_init() { + if File_multi_files_file2_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_file2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_multi_files_file2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request2); i { case 0: return &v.state @@ -191,7 +191,7 @@ func file_file2_proto_init() { return nil } } - file_file2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_multi_files_file2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply2); i { case 0: return &v.state @@ -208,18 +208,18 @@ func file_file2_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_file2_proto_rawDesc, + RawDescriptor: file_multi_files_file2_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_file2_proto_goTypes, - DependencyIndexes: file_file2_proto_depIdxs, - MessageInfos: file_file2_proto_msgTypes, + GoTypes: file_multi_files_file2_proto_goTypes, + DependencyIndexes: file_multi_files_file2_proto_depIdxs, + MessageInfos: file_multi_files_file2_proto_msgTypes, }.Build() - File_file2_proto = out.File - file_file2_proto_rawDesc = nil - file_file2_proto_goTypes = nil - file_file2_proto_depIdxs = nil + File_multi_files_file2_proto = out.File + file_multi_files_file2_proto_rawDesc = nil + file_multi_files_file2_proto_goTypes = nil + file_multi_files_file2_proto_depIdxs = nil } diff --git a/protogen/example/multi-files/file2_grpc.pb.go b/protogen/example/multi-files/file2_grpc.pb.go index 8091c5ea..bc9132e9 100644 --- a/protogen/example/multi-files/file2_grpc.pb.go +++ b/protogen/example/multi-files/file2_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: file2.proto +// - protoc v4.25.1 +// source: multi-files/file2.proto package multi_files @@ -107,5 +107,5 @@ var Gripmock2_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "file2.proto", + Metadata: "multi-files/file2.proto", } diff --git a/protogen/example/multi-package/bar/bar.pb.go b/protogen/example/multi-package/bar/bar.pb.go index c81ad4af..f6538994 100644 --- a/protogen/example/multi-package/bar/bar.pb.go +++ b/protogen/example/multi-package/bar/bar.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: bar.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: multi-package/bar/bar.proto -package bar +package multi_package import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -31,7 +31,7 @@ type Bar struct { func (x *Bar) Reset() { *x = Bar{} if protoimpl.UnsafeEnabled { - mi := &file_bar_proto_msgTypes[0] + mi := &file_multi_package_bar_bar_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -44,7 +44,7 @@ func (x *Bar) String() string { func (*Bar) ProtoMessage() {} func (x *Bar) ProtoReflect() protoreflect.Message { - mi := &file_bar_proto_msgTypes[0] + mi := &file_multi_package_bar_bar_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -57,7 +57,7 @@ func (x *Bar) ProtoReflect() protoreflect.Message { // Deprecated: Use Bar.ProtoReflect.Descriptor instead. func (*Bar) Descriptor() ([]byte, []int) { - return file_bar_proto_rawDescGZIP(), []int{0} + return file_multi_package_bar_bar_proto_rawDescGZIP(), []int{0} } func (x *Bar) GetName() string { @@ -67,36 +67,37 @@ func (x *Bar) GetName() string { return "" } -var File_bar_proto protoreflect.FileDescriptor - -var file_bar_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x62, 0x61, 0x72, - 0x22, 0x19, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x42, 0x5a, 0x40, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, - 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x62, 0x61, 0x72, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_multi_package_bar_bar_proto protoreflect.FileDescriptor + +var file_multi_package_bar_bar_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, + 0x62, 0x61, 0x72, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x62, + 0x61, 0x72, 0x22, 0x19, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x43, 0x5a, + 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x2f, 0x62, 0x61, 0x72, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_bar_proto_rawDescOnce sync.Once - file_bar_proto_rawDescData = file_bar_proto_rawDesc + file_multi_package_bar_bar_proto_rawDescOnce sync.Once + file_multi_package_bar_bar_proto_rawDescData = file_multi_package_bar_bar_proto_rawDesc ) -func file_bar_proto_rawDescGZIP() []byte { - file_bar_proto_rawDescOnce.Do(func() { - file_bar_proto_rawDescData = protoimpl.X.CompressGZIP(file_bar_proto_rawDescData) +func file_multi_package_bar_bar_proto_rawDescGZIP() []byte { + file_multi_package_bar_bar_proto_rawDescOnce.Do(func() { + file_multi_package_bar_bar_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_package_bar_bar_proto_rawDescData) }) - return file_bar_proto_rawDescData + return file_multi_package_bar_bar_proto_rawDescData } -var file_bar_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_bar_proto_goTypes = []interface{}{ +var file_multi_package_bar_bar_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_multi_package_bar_bar_proto_goTypes = []interface{}{ (*Bar)(nil), // 0: bar.Bar } -var file_bar_proto_depIdxs = []int32{ +var file_multi_package_bar_bar_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 @@ -104,13 +105,13 @@ var file_bar_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_bar_proto_init() } -func file_bar_proto_init() { - if File_bar_proto != nil { +func init() { file_multi_package_bar_bar_proto_init() } +func file_multi_package_bar_bar_proto_init() { + if File_multi_package_bar_bar_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_bar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_multi_package_bar_bar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bar); i { case 0: return &v.state @@ -127,18 +128,18 @@ func file_bar_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_bar_proto_rawDesc, + RawDescriptor: file_multi_package_bar_bar_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_bar_proto_goTypes, - DependencyIndexes: file_bar_proto_depIdxs, - MessageInfos: file_bar_proto_msgTypes, + GoTypes: file_multi_package_bar_bar_proto_goTypes, + DependencyIndexes: file_multi_package_bar_bar_proto_depIdxs, + MessageInfos: file_multi_package_bar_bar_proto_msgTypes, }.Build() - File_bar_proto = out.File - file_bar_proto_rawDesc = nil - file_bar_proto_goTypes = nil - file_bar_proto_depIdxs = nil + File_multi_package_bar_bar_proto = out.File + file_multi_package_bar_bar_proto_rawDesc = nil + file_multi_package_bar_bar_proto_goTypes = nil + file_multi_package_bar_bar_proto_depIdxs = nil } diff --git a/protogen/example/multi-package/foo.pb.go b/protogen/example/multi-package/foo.pb.go index 2ab1f9d4..26a47f01 100644 --- a/protogen/example/multi-package/foo.pb.go +++ b/protogen/example/multi-package/foo.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: foo.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: multi-package/foo.proto // simulating neighboring .proto file // but different package @@ -34,7 +34,7 @@ type Response struct { func (x *Response) Reset() { *x = Response{} if protoimpl.UnsafeEnabled { - mi := &file_foo_proto_msgTypes[0] + mi := &file_multi_package_foo_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +47,7 @@ func (x *Response) String() string { func (*Response) ProtoMessage() {} func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_foo_proto_msgTypes[0] + mi := &file_multi_package_foo_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +60,7 @@ func (x *Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Response.ProtoReflect.Descriptor instead. func (*Response) Descriptor() ([]byte, []int) { - return file_foo_proto_rawDescGZIP(), []int{0} + return file_multi_package_foo_proto_rawDescGZIP(), []int{0} } func (x *Response) GetResponse() string { @@ -70,36 +70,36 @@ func (x *Response) GetResponse() string { return "" } -var File_foo_proto protoreflect.FileDescriptor - -var file_foo_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x66, 0x6f, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6f, 0x6f, - 0x22, 0x26, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, - 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, - 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_multi_package_foo_proto protoreflect.FileDescriptor + +var file_multi_package_foo_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, + 0x66, 0x6f, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6f, 0x6f, 0x22, 0x26, + 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x79, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2f, + 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_foo_proto_rawDescOnce sync.Once - file_foo_proto_rawDescData = file_foo_proto_rawDesc + file_multi_package_foo_proto_rawDescOnce sync.Once + file_multi_package_foo_proto_rawDescData = file_multi_package_foo_proto_rawDesc ) -func file_foo_proto_rawDescGZIP() []byte { - file_foo_proto_rawDescOnce.Do(func() { - file_foo_proto_rawDescData = protoimpl.X.CompressGZIP(file_foo_proto_rawDescData) +func file_multi_package_foo_proto_rawDescGZIP() []byte { + file_multi_package_foo_proto_rawDescOnce.Do(func() { + file_multi_package_foo_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_package_foo_proto_rawDescData) }) - return file_foo_proto_rawDescData + return file_multi_package_foo_proto_rawDescData } -var file_foo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_foo_proto_goTypes = []interface{}{ +var file_multi_package_foo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_multi_package_foo_proto_goTypes = []interface{}{ (*Response)(nil), // 0: foo.Response } -var file_foo_proto_depIdxs = []int32{ +var file_multi_package_foo_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 @@ -107,13 +107,13 @@ var file_foo_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_foo_proto_init() } -func file_foo_proto_init() { - if File_foo_proto != nil { +func init() { file_multi_package_foo_proto_init() } +func file_multi_package_foo_proto_init() { + if File_multi_package_foo_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_foo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_multi_package_foo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Response); i { case 0: return &v.state @@ -130,18 +130,18 @@ func file_foo_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_foo_proto_rawDesc, + RawDescriptor: file_multi_package_foo_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_foo_proto_goTypes, - DependencyIndexes: file_foo_proto_depIdxs, - MessageInfos: file_foo_proto_msgTypes, + GoTypes: file_multi_package_foo_proto_goTypes, + DependencyIndexes: file_multi_package_foo_proto_depIdxs, + MessageInfos: file_multi_package_foo_proto_msgTypes, }.Build() - File_foo_proto = out.File - file_foo_proto_rawDesc = nil - file_foo_proto_goTypes = nil - file_foo_proto_depIdxs = nil + File_multi_package_foo_proto = out.File + file_multi_package_foo_proto_rawDesc = nil + file_multi_package_foo_proto_goTypes = nil + file_multi_package_foo_proto_depIdxs = nil } diff --git a/protogen/example/one-of/oneof.pb.go b/protogen/example/one-of/oneof.pb.go index ac918802..1aa7b4c3 100644 --- a/protogen/example/one-of/oneof.pb.go +++ b/protogen/example/one-of/oneof.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: oneof.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: one-of/oneof.proto package one_of @@ -32,7 +32,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_oneof_proto_msgTypes[0] + mi := &file_one_of_oneof_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_oneof_proto_msgTypes[0] + mi := &file_one_of_oneof_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 *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_oneof_proto_rawDescGZIP(), []int{0} + return file_one_of_oneof_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -83,7 +83,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_oneof_proto_msgTypes[1] + mi := &file_one_of_oneof_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96,7 +96,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_oneof_proto_msgTypes[1] + mi := &file_one_of_oneof_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109,7 +109,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_oneof_proto_rawDescGZIP(), []int{1} + return file_one_of_oneof_proto_rawDescGZIP(), []int{1} } func (m *Reply) GetReplyType() isReply_ReplyType { @@ -162,7 +162,7 @@ type Reply1 struct { func (x *Reply1) Reset() { *x = Reply1{} if protoimpl.UnsafeEnabled { - mi := &file_oneof_proto_msgTypes[2] + mi := &file_one_of_oneof_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -175,7 +175,7 @@ func (x *Reply1) String() string { func (*Reply1) ProtoMessage() {} func (x *Reply1) ProtoReflect() protoreflect.Message { - mi := &file_oneof_proto_msgTypes[2] + mi := &file_one_of_oneof_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -188,7 +188,7 @@ func (x *Reply1) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply1.ProtoReflect.Descriptor instead. func (*Reply1) Descriptor() ([]byte, []int) { - return file_oneof_proto_rawDescGZIP(), []int{2} + return file_one_of_oneof_proto_rawDescGZIP(), []int{2} } func (x *Reply1) GetMessage() string { @@ -217,7 +217,7 @@ type Reply2 struct { func (x *Reply2) Reset() { *x = Reply2{} if protoimpl.UnsafeEnabled { - mi := &file_oneof_proto_msgTypes[3] + mi := &file_one_of_oneof_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -230,7 +230,7 @@ func (x *Reply2) String() string { func (*Reply2) ProtoMessage() {} func (x *Reply2) ProtoReflect() protoreflect.Message { - mi := &file_oneof_proto_msgTypes[3] + mi := &file_one_of_oneof_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -243,7 +243,7 @@ func (x *Reply2) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply2.ProtoReflect.Descriptor instead. func (*Reply2) Descriptor() ([]byte, []int) { - return file_oneof_proto_rawDescGZIP(), []int{3} + return file_one_of_oneof_proto_rawDescGZIP(), []int{3} } func (x *Reply2) GetOther() int32 { @@ -253,55 +253,55 @@ func (x *Reply2) GetOther() int32 { return 0 } -var File_oneof_proto protoreflect.FileDescriptor - -var file_oneof_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x1d, 0x0a, 0x07, 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, 0x66, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, - 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x48, 0x00, 0x52, 0x06, 0x72, - 0x65, 0x70, 0x6c, 0x79, 0x31, 0x12, 0x27, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x32, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x0b, - 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, - 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, - 0x22, 0x1e, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x74, - 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, - 0x32, 0x34, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x08, - 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0e, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, - 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, - 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_one_of_oneof_proto protoreflect.FileDescriptor + +var file_one_of_oneof_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x1d, 0x0a, 0x07, 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, 0x66, 0x0a, 0x05, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x31, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x12, 0x27, 0x0a, 0x06, + 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x48, 0x00, 0x52, 0x06, 0x72, + 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x79, + 0x70, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x1e, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x32, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x32, 0x34, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, + 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, + 0x0e, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0c, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( - file_oneof_proto_rawDescOnce sync.Once - file_oneof_proto_rawDescData = file_oneof_proto_rawDesc + file_one_of_oneof_proto_rawDescOnce sync.Once + file_one_of_oneof_proto_rawDescData = file_one_of_oneof_proto_rawDesc ) -func file_oneof_proto_rawDescGZIP() []byte { - file_oneof_proto_rawDescOnce.Do(func() { - file_oneof_proto_rawDescData = protoimpl.X.CompressGZIP(file_oneof_proto_rawDescData) +func file_one_of_oneof_proto_rawDescGZIP() []byte { + file_one_of_oneof_proto_rawDescOnce.Do(func() { + file_one_of_oneof_proto_rawDescData = protoimpl.X.CompressGZIP(file_one_of_oneof_proto_rawDescData) }) - return file_oneof_proto_rawDescData + return file_one_of_oneof_proto_rawDescData } -var file_oneof_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_oneof_proto_goTypes = []interface{}{ +var file_one_of_oneof_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_one_of_oneof_proto_goTypes = []interface{}{ (*Request)(nil), // 0: oneof.Request (*Reply)(nil), // 1: oneof.Reply (*Reply1)(nil), // 2: oneof.Reply1 (*Reply2)(nil), // 3: oneof.Reply2 } -var file_oneof_proto_depIdxs = []int32{ +var file_one_of_oneof_proto_depIdxs = []int32{ 2, // 0: oneof.Reply.reply1:type_name -> oneof.Reply1 3, // 1: oneof.Reply.reply2:type_name -> oneof.Reply2 0, // 2: oneof.Gripmock.SayHello:input_type -> oneof.Request @@ -313,13 +313,13 @@ var file_oneof_proto_depIdxs = []int32{ 0, // [0:2] is the sub-list for field type_name } -func init() { file_oneof_proto_init() } -func file_oneof_proto_init() { - if File_oneof_proto != nil { +func init() { file_one_of_oneof_proto_init() } +func file_one_of_oneof_proto_init() { + if File_one_of_oneof_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_oneof_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_one_of_oneof_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -331,7 +331,7 @@ func file_oneof_proto_init() { return nil } } - file_oneof_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_one_of_oneof_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -343,7 +343,7 @@ func file_oneof_proto_init() { return nil } } - file_oneof_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_one_of_oneof_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply1); i { case 0: return &v.state @@ -355,7 +355,7 @@ func file_oneof_proto_init() { return nil } } - file_oneof_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_one_of_oneof_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply2); i { case 0: return &v.state @@ -368,7 +368,7 @@ func file_oneof_proto_init() { } } } - file_oneof_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_one_of_oneof_proto_msgTypes[1].OneofWrappers = []interface{}{ (*Reply_Reply1)(nil), (*Reply_Reply2)(nil), } @@ -376,18 +376,18 @@ func file_oneof_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_oneof_proto_rawDesc, + RawDescriptor: file_one_of_oneof_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_oneof_proto_goTypes, - DependencyIndexes: file_oneof_proto_depIdxs, - MessageInfos: file_oneof_proto_msgTypes, + GoTypes: file_one_of_oneof_proto_goTypes, + DependencyIndexes: file_one_of_oneof_proto_depIdxs, + MessageInfos: file_one_of_oneof_proto_msgTypes, }.Build() - File_oneof_proto = out.File - file_oneof_proto_rawDesc = nil - file_oneof_proto_goTypes = nil - file_oneof_proto_depIdxs = nil + File_one_of_oneof_proto = out.File + file_one_of_oneof_proto_rawDesc = nil + file_one_of_oneof_proto_goTypes = nil + file_one_of_oneof_proto_depIdxs = nil } diff --git a/protogen/example/one-of/oneof_grpc.pb.go b/protogen/example/one-of/oneof_grpc.pb.go index 645dd68d..c8dd85b2 100644 --- a/protogen/example/one-of/oneof_grpc.pb.go +++ b/protogen/example/one-of/oneof_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: oneof.proto +// - protoc v4.25.1 +// source: one-of/oneof.proto package one_of @@ -107,5 +107,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "oneof.proto", + Metadata: "one-of/oneof.proto", } diff --git a/protogen/example/simple/simple.pb.go b/protogen/example/simple/simple.pb.go index d83c90e8..ab8239c2 100644 --- a/protogen/example/simple/simple.pb.go +++ b/protogen/example/simple/simple.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.24.3 -// source: simple.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: simple/simple.proto package simple @@ -26,15 +26,16 @@ type Request struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Vint64 int64 `protobuf:"varint,2,opt,name=vint64,proto3" json:"vint64,omitempty"` - Vuint64 uint64 `protobuf:"varint,3,opt,name=vuint64,proto3" json:"vuint64,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Vint64 int64 `protobuf:"varint,2,opt,name=vint64,proto3" json:"vint64,omitempty"` + Vuint64 uint64 `protobuf:"varint,3,opt,name=vuint64,proto3" json:"vuint64,omitempty"` + Values []int64 `protobuf:"varint,4,rep,packed,name=values,proto3" json:"values,omitempty"` } func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_simple_proto_msgTypes[0] + mi := &file_simple_simple_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +48,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_simple_proto_msgTypes[0] + mi := &file_simple_simple_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +61,7 @@ func (x *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_simple_proto_rawDescGZIP(), []int{0} + return file_simple_simple_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -84,6 +85,13 @@ func (x *Request) GetVuint64() uint64 { return 0 } +func (x *Request) GetValues() []int64 { + if x != nil { + return x.Values + } + return nil +} + // The response message containing the greetings type Reply struct { state protoimpl.MessageState @@ -99,7 +107,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_simple_proto_msgTypes[1] + mi := &file_simple_simple_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112,7 +120,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_simple_proto_msgTypes[1] + mi := &file_simple_simple_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -125,7 +133,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_simple_proto_rawDescGZIP(), []int{1} + return file_simple_simple_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetMessage() string { @@ -156,50 +164,52 @@ func (x *Reply) GetVuint64() uint64 { return 0 } -var File_simple_proto protoreflect.FileDescriptor +var File_simple_simple_proto protoreflect.FileDescriptor -var file_simple_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0x4f, 0x0a, 0x07, 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, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, - 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x22, 0x74, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, - 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x32, 0x36, 0x0a, - 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x2a, 0x0a, 0x08, 0x53, 0x61, 0x79, - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0f, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, - 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, 0x6c, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_simple_simple_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0x67, 0x0a, + 0x07, 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, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x16, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x74, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x32, 0x36, 0x0a, 0x08, + 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x2a, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0f, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, + 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_simple_proto_rawDescOnce sync.Once - file_simple_proto_rawDescData = file_simple_proto_rawDesc + file_simple_simple_proto_rawDescOnce sync.Once + file_simple_simple_proto_rawDescData = file_simple_simple_proto_rawDesc ) -func file_simple_proto_rawDescGZIP() []byte { - file_simple_proto_rawDescOnce.Do(func() { - file_simple_proto_rawDescData = protoimpl.X.CompressGZIP(file_simple_proto_rawDescData) +func file_simple_simple_proto_rawDescGZIP() []byte { + file_simple_simple_proto_rawDescOnce.Do(func() { + file_simple_simple_proto_rawDescData = protoimpl.X.CompressGZIP(file_simple_simple_proto_rawDescData) }) - return file_simple_proto_rawDescData + return file_simple_simple_proto_rawDescData } -var file_simple_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_simple_proto_goTypes = []interface{}{ +var file_simple_simple_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_simple_simple_proto_goTypes = []interface{}{ (*Request)(nil), // 0: simple.Request (*Reply)(nil), // 1: simple.Reply } -var file_simple_proto_depIdxs = []int32{ +var file_simple_simple_proto_depIdxs = []int32{ 0, // 0: simple.Gripmock.SayHello:input_type -> simple.Request 1, // 1: simple.Gripmock.SayHello:output_type -> simple.Reply 1, // [1:2] is the sub-list for method output_type @@ -209,13 +219,13 @@ var file_simple_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_simple_proto_init() } -func file_simple_proto_init() { - if File_simple_proto != nil { +func init() { file_simple_simple_proto_init() } +func file_simple_simple_proto_init() { + if File_simple_simple_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_simple_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_simple_simple_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -227,7 +237,7 @@ func file_simple_proto_init() { return nil } } - file_simple_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_simple_simple_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -244,18 +254,18 @@ func file_simple_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_simple_proto_rawDesc, + RawDescriptor: file_simple_simple_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_simple_proto_goTypes, - DependencyIndexes: file_simple_proto_depIdxs, - MessageInfos: file_simple_proto_msgTypes, + GoTypes: file_simple_simple_proto_goTypes, + DependencyIndexes: file_simple_simple_proto_depIdxs, + MessageInfos: file_simple_simple_proto_msgTypes, }.Build() - File_simple_proto = out.File - file_simple_proto_rawDesc = nil - file_simple_proto_goTypes = nil - file_simple_proto_depIdxs = nil + File_simple_simple_proto = out.File + file_simple_simple_proto_rawDesc = nil + file_simple_simple_proto_goTypes = nil + file_simple_simple_proto_depIdxs = nil } diff --git a/protogen/example/simple/simple_grpc.pb.go b/protogen/example/simple/simple_grpc.pb.go index 8f457ad5..b5cbd24e 100644 --- a/protogen/example/simple/simple_grpc.pb.go +++ b/protogen/example/simple/simple_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.3 -// source: simple.proto +// - protoc v4.25.1 +// source: simple/simple.proto package simple @@ -107,5 +107,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "simple.proto", + Metadata: "simple/simple.proto", } diff --git a/protogen/example/stream/stream.pb.go b/protogen/example/stream/stream.pb.go index 122449f9..961e80ae 100644 --- a/protogen/example/stream/stream.pb.go +++ b/protogen/example/stream/stream.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: stream.proto +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: stream/stream.proto package stream @@ -32,7 +32,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_stream_proto_msgTypes[0] + mi := &file_stream_stream_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_stream_proto_msgTypes[0] + mi := &file_stream_stream_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 *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_stream_proto_rawDescGZIP(), []int{0} + return file_stream_stream_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -80,7 +80,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_stream_proto_msgTypes[1] + mi := &file_stream_stream_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93,7 +93,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_stream_proto_msgTypes[1] + mi := &file_stream_stream_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106,7 +106,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_stream_proto_rawDescGZIP(), []int{1} + return file_stream_stream_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetMessage() string { @@ -116,49 +116,49 @@ func (x *Reply) GetMessage() string { return "" } -var File_stream_proto protoreflect.FileDescriptor - -var file_stream_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x1d, 0x0a, 0x07, 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, 0x21, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 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, 0xa3, 0x01, 0x0a, 0x08, 0x47, 0x72, 0x69, - 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x30, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x30, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x12, 0x33, 0x0a, 0x0d, 0x62, 0x69, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x30, 0x01, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, - 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_stream_stream_proto protoreflect.FileDescriptor + +var file_stream_stream_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x1d, 0x0a, + 0x07, 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, 0x21, 0x0a, 0x05, + 0x52, 0x65, 0x70, 0x6c, 0x79, 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, + 0xa3, 0x01, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x30, 0x0a, 0x0c, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x30, + 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, + 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, + 0x12, 0x33, 0x0a, 0x0d, 0x62, 0x69, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, + 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_stream_proto_rawDescOnce sync.Once - file_stream_proto_rawDescData = file_stream_proto_rawDesc + file_stream_stream_proto_rawDescOnce sync.Once + file_stream_stream_proto_rawDescData = file_stream_stream_proto_rawDesc ) -func file_stream_proto_rawDescGZIP() []byte { - file_stream_proto_rawDescOnce.Do(func() { - file_stream_proto_rawDescData = protoimpl.X.CompressGZIP(file_stream_proto_rawDescData) +func file_stream_stream_proto_rawDescGZIP() []byte { + file_stream_stream_proto_rawDescOnce.Do(func() { + file_stream_stream_proto_rawDescData = protoimpl.X.CompressGZIP(file_stream_stream_proto_rawDescData) }) - return file_stream_proto_rawDescData + return file_stream_stream_proto_rawDescData } -var file_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_stream_proto_goTypes = []interface{}{ +var file_stream_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_stream_stream_proto_goTypes = []interface{}{ (*Request)(nil), // 0: stream.Request (*Reply)(nil), // 1: stream.Reply } -var file_stream_proto_depIdxs = []int32{ +var file_stream_stream_proto_depIdxs = []int32{ 0, // 0: stream.Gripmock.serverStream:input_type -> stream.Request 0, // 1: stream.Gripmock.clientStream:input_type -> stream.Request 0, // 2: stream.Gripmock.bidirectional:input_type -> stream.Request @@ -172,13 +172,13 @@ var file_stream_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_stream_proto_init() } -func file_stream_proto_init() { - if File_stream_proto != nil { +func init() { file_stream_stream_proto_init() } +func file_stream_stream_proto_init() { + if File_stream_stream_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_stream_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -190,7 +190,7 @@ func file_stream_proto_init() { return nil } } - file_stream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_stream_stream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -207,18 +207,18 @@ func file_stream_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_stream_proto_rawDesc, + RawDescriptor: file_stream_stream_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_stream_proto_goTypes, - DependencyIndexes: file_stream_proto_depIdxs, - MessageInfos: file_stream_proto_msgTypes, + GoTypes: file_stream_stream_proto_goTypes, + DependencyIndexes: file_stream_stream_proto_depIdxs, + MessageInfos: file_stream_stream_proto_msgTypes, }.Build() - File_stream_proto = out.File - file_stream_proto_rawDesc = nil - file_stream_proto_goTypes = nil - file_stream_proto_depIdxs = nil + File_stream_stream_proto = out.File + file_stream_stream_proto_rawDesc = nil + file_stream_stream_proto_goTypes = nil + file_stream_stream_proto_depIdxs = nil } diff --git a/protogen/example/stream/stream_grpc.pb.go b/protogen/example/stream/stream_grpc.pb.go index f38eaff7..71387f94 100644 --- a/protogen/example/stream/stream_grpc.pb.go +++ b/protogen/example/stream/stream_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: stream.proto +// - protoc v4.25.1 +// source: stream/stream.proto package stream @@ -278,5 +278,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "stream.proto", + Metadata: "stream/stream.proto", } diff --git a/protogen/go.mod b/protogen/go.mod index 95a93c2f..e8e35dde 100644 --- a/protogen/go.mod +++ b/protogen/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 - google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 + google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -18,9 +18,9 @@ require ( go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect ) diff --git a/protogen/go.sum b/protogen/go.sum index e20becea..aa75aa6f 100644 --- a/protogen/go.sum +++ b/protogen/go.sum @@ -12,8 +12,6 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7 github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -38,12 +36,10 @@ go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ3 go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= @@ -51,18 +47,12 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= -google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 h1:/IWabOtPziuXTEtI1KYCpM6Ss7vaAkeMxk+uXV/xvZs= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 h1:OPXtXn7fNMaXwO3JvOmF1QyTc00jsSFFz1vXXBOdCDo= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From 4e1c33fd1708c9b0d7b566bb016108e2b4af67aa Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 21:38:14 +0300 Subject: [PATCH 2/6] [2.6] fix feature ignoreArrayOrder --- deployments/docker-compose/docker-compose.yml | 3 + example/ms/client/main.go | 54 +++++ example/ms/entrypoint.sh | 10 + example/ms/ms.proto | 18 ++ example/ms/stub/strict.yml | 28 +++ example/simple/client/main.go | 6 - example/simple/stub/strict.yml | 15 -- internal/app/storage.go | 20 +- protogen/example/ms/ms.pb.go | 218 ++++++++++++++++++ protogen/example/ms/ms_grpc.pb.go | 109 +++++++++ protogen/example/multi-files/file1.proto | 22 -- protogen/example/multi-files/file2.proto | 21 -- protogen/example/multi-package/bar/bar.proto | 10 - protogen/example/multi-package/foo.proto | 13 -- protogen/example/multi-package/hello.proto | 14 -- protogen/example/one-of/oneof.proto | 35 --- protogen/example/simple/simple.proto | 23 -- protogen/example/stream/stream.proto | 25 -- .../stub-subfolders/stub-subfolders.proto | 21 -- protogen/example/well_known_types/wkt.proto | 15 -- 20 files changed, 454 insertions(+), 226 deletions(-) create mode 100644 example/ms/client/main.go create mode 100755 example/ms/entrypoint.sh create mode 100644 example/ms/ms.proto create mode 100644 example/ms/stub/strict.yml create mode 100644 protogen/example/ms/ms.pb.go create mode 100644 protogen/example/ms/ms_grpc.pb.go delete mode 100644 protogen/example/multi-files/file1.proto delete mode 100644 protogen/example/multi-files/file2.proto delete mode 100644 protogen/example/multi-package/bar/bar.proto delete mode 100644 protogen/example/multi-package/foo.proto delete mode 100644 protogen/example/multi-package/hello.proto delete mode 100644 protogen/example/one-of/oneof.proto delete mode 100644 protogen/example/simple/simple.proto delete mode 100644 protogen/example/stream/stream.proto delete mode 100644 protogen/example/stub-subfolders/stub-subfolders.proto delete mode 100644 protogen/example/well_known_types/wkt.proto diff --git a/deployments/docker-compose/docker-compose.yml b/deployments/docker-compose/docker-compose.yml index 2043ad98..237fb829 100644 --- a/deployments/docker-compose/docker-compose.yml +++ b/deployments/docker-compose/docker-compose.yml @@ -1,5 +1,8 @@ version: '3.8' services: + ms: + image: bavix/gripmock:latest + entrypoint: example/ms/entrypoint.sh simple: image: bavix/gripmock:latest entrypoint: example/simple/entrypoint.sh diff --git a/example/ms/client/main.go b/example/ms/client/main.go new file mode 100644 index 00000000..23355c24 --- /dev/null +++ b/example/ms/client/main.go @@ -0,0 +1,54 @@ +package main + +import ( + "context" + "github.com/google/uuid" + "log" + "time" + + pb "github.com/bavix/gripmock/protogen/example/ms" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +//nolint:gomnd +func main() { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + + conn, err := grpc.DialContext(ctx, "localhost:4770", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + if err != nil { + log.Fatalf("did not connect: %v", err) + } + defer conn.Close() + + c := pb.NewMicroServiceClient(conn) + + r1, err := c.SayHello(context.Background(), &pb.Request{V1: [][]byte{ + u2bytes("ab0ed195-6ac5-4006-a98b-6978c6ed1c6b"), // 3 + u2bytes("99aebcf2-b56d-4923-9266-ab72bf5b9d0b"), // 1 + u2bytes("5659bec5-dda5-4e87-bef4-e9e37c60eb1c"), // 2 + u2bytes("77465064-a0ce-48a3-b7e4-d50f88e55093"), // 0 + }}) + if err != nil { + log.Fatalf("error from grpc: %v", err) + } + log.Printf("Result: %d", r1.Code) + + r2, err := c.SayHello(context.Background(), &pb.Request{V2: []string{ + "e3484119-24e1-42d9-b4c2-7d6004ee86d9", // 1 + "c30f45d2-f8a4-4a94-a994-4cc349bca457", // 3 + "f1e9ed24-93ba-4e4f-ab9f-3942196d5c03", // 0 + "cc991218-a920-40c8-9f42-3b329c8723f2", // 2 + }}) + if err != nil { + log.Fatalf("error from grpc: %v", err) + } + log.Printf("Result: %d", r2.Code) +} + +func u2bytes(v string) []byte { + u := uuid.MustParse(v) + + return u[:] +} diff --git a/example/ms/entrypoint.sh b/example/ms/entrypoint.sh new file mode 100755 index 00000000..1aa38462 --- /dev/null +++ b/example/ms/entrypoint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +# this file is used by .github/workflows/integration-test.yml + +gripmock --stub=example/ms/stub example/ms/ms.proto & + +# wait for generated files to be available and gripmock is up +sleep 2 + +go run example/ms/client/*.go \ No newline at end of file diff --git a/example/ms/ms.proto b/example/ms/ms.proto new file mode 100644 index 00000000..dbc07ea6 --- /dev/null +++ b/example/ms/ms.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ms; + +option go_package = "github.com/bavix/gripmock/example/ms"; + +service MicroService { + rpc SayHello (Request) returns (Reply); +} + +message Request { + repeated bytes v1 = 1; + repeated string v2 = 2; +} + +message Reply { + int64 code = 1; +} diff --git a/example/ms/stub/strict.yml b/example/ms/stub/strict.yml new file mode 100644 index 00000000..fcb3cbfc --- /dev/null +++ b/example/ms/stub/strict.yml @@ -0,0 +1,28 @@ +--- +- service: MicroService + method: SayHello + input: + ignoreArrayOrder: true + equals: + v1: + - {{ uuid2base64 "77465064-a0ce-48a3-b7e4-d50f88e55093" }} + - {{ uuid2base64 "99aebcf2-b56d-4923-9266-ab72bf5b9d0b" }} + - {{ uuid2base64 "5659bec5-dda5-4e87-bef4-e9e37c60eb1c" }} + - {{ uuid2base64 "ab0ed195-6ac5-4006-a98b-6978c6ed1c6b" }} + output: + data: + code: 1000 + +- service: MicroService + method: SayHello + input: + ignoreArrayOrder: true + equals: + v2: + - f1e9ed24-93ba-4e4f-ab9f-3942196d5c03 + - e3484119-24e1-42d9-b4c2-7d6004ee86d9 + - cc991218-a920-40c8-9f42-3b329c8723f2 + - c30f45d2-f8a4-4a94-a994-4cc349bca457 + output: + data: + code: 2000 diff --git a/example/simple/client/main.go b/example/simple/client/main.go index 777cb006..efd5cb11 100644 --- a/example/simple/client/main.go +++ b/example/simple/client/main.go @@ -194,12 +194,6 @@ func main() { } log.Printf("Greeting: %s (return code %d)", r.Message, r.ReturnCode) - // ignoreArrayOrder=false - r, err = c.SayHello(context.Background(), &pb.Request{Values: []int64{1, 2, 3, 4, 5, 6}}) - if err == nil { - log.Fatal("error it is expected that there will be no stubs") - } - // ignoreArrayOrder=true r, err = c.SayHello(context.Background(), &pb.Request{Values: []int64{10, 20, 30, 40, 50, 60, 70}}) if err != nil { diff --git a/example/simple/stub/strict.yml b/example/simple/stub/strict.yml index 217b7b86..5c463373 100644 --- a/example/simple/stub/strict.yml +++ b/example/simple/stub/strict.yml @@ -1,19 +1,4 @@ --- -- service: Gripmock - method: SayHello - input: - equals: - values: - - 1 - - 2 - - 3 - - 6 - - 5 - - 4 - output: - data: - message: "6. strict mode" - - service: Gripmock method: SayHello input: diff --git a/internal/app/storage.go b/internal/app/storage.go index 03a5b75a..5a4bad39 100644 --- a/internal/app/storage.go +++ b/internal/app/storage.go @@ -295,13 +295,25 @@ func cmpValue(a, b []interface{}, f matchFunc) bool { d := len(a) c := make([]interface{}, 0, d) + usedA := make(map[int]bool, len(a)) + usedB := make(map[int]bool, len(b)) + for i := 0; i < d; i++ { for ia, va := range a { + if usedA[ia] { + continue + } + for ib, vb := range b { + if usedB[ib] { + continue + } + if f(va, vb) { c = append(c, va) - a = remove(a, ia) - b = remove(b, ib) + + usedA[ia] = true + usedB[ib] = true } } } @@ -309,7 +321,3 @@ func cmpValue(a, b []interface{}, f matchFunc) bool { return d == len(c) } - -func remove(s []interface{}, i int) []interface{} { - return append(s[:i], s[i+1:]...) -} diff --git a/protogen/example/ms/ms.pb.go b/protogen/example/ms/ms.pb.go new file mode 100644 index 00000000..c8c627fb --- /dev/null +++ b/protogen/example/ms/ms.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: ms/ms.proto + +package ms + +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 Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V1 [][]byte `protobuf:"bytes,1,rep,name=v1,proto3" json:"v1,omitempty"` + V2 []string `protobuf:"bytes,2,rep,name=v2,proto3" json:"v2,omitempty"` +} + +func (x *Request) Reset() { + *x = Request{} + if protoimpl.UnsafeEnabled { + mi := &file_ms_ms_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_ms_ms_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 Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_ms_ms_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetV1() [][]byte { + if x != nil { + return x.V1 + } + return nil +} + +func (x *Request) GetV2() []string { + if x != nil { + return x.V2 + } + return nil +} + +type Reply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *Reply) Reset() { + *x = Reply{} + if protoimpl.UnsafeEnabled { + mi := &file_ms_ms_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reply) ProtoMessage() {} + +func (x *Reply) ProtoReflect() protoreflect.Message { + mi := &file_ms_ms_proto_msgTypes[1] + 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 Reply.ProtoReflect.Descriptor instead. +func (*Reply) Descriptor() ([]byte, []int) { + return file_ms_ms_proto_rawDescGZIP(), []int{1} +} + +func (x *Reply) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +var File_ms_ms_proto protoreflect.FileDescriptor + +var file_ms_ms_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x6d, 0x73, 0x2f, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x6d, + 0x73, 0x22, 0x29, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x76, 0x31, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02, 0x76, 0x31, 0x12, 0x0e, 0x0a, 0x02, + 0x76, 0x32, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x76, 0x32, 0x22, 0x1b, 0x0a, 0x05, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x32, 0x32, 0x0a, 0x0c, 0x4d, 0x69, 0x63, + 0x72, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x08, 0x53, 0x61, 0x79, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0b, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x26, 0x5a, + 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ms_ms_proto_rawDescOnce sync.Once + file_ms_ms_proto_rawDescData = file_ms_ms_proto_rawDesc +) + +func file_ms_ms_proto_rawDescGZIP() []byte { + file_ms_ms_proto_rawDescOnce.Do(func() { + file_ms_ms_proto_rawDescData = protoimpl.X.CompressGZIP(file_ms_ms_proto_rawDescData) + }) + return file_ms_ms_proto_rawDescData +} + +var file_ms_ms_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ms_ms_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: ms.Request + (*Reply)(nil), // 1: ms.Reply +} +var file_ms_ms_proto_depIdxs = []int32{ + 0, // 0: ms.MicroService.SayHello:input_type -> ms.Request + 1, // 1: ms.MicroService.SayHello:output_type -> ms.Reply + 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_ms_ms_proto_init() } +func file_ms_ms_proto_init() { + if File_ms_ms_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ms_ms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ms_ms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reply); 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_ms_ms_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_ms_ms_proto_goTypes, + DependencyIndexes: file_ms_ms_proto_depIdxs, + MessageInfos: file_ms_ms_proto_msgTypes, + }.Build() + File_ms_ms_proto = out.File + file_ms_ms_proto_rawDesc = nil + file_ms_ms_proto_goTypes = nil + file_ms_ms_proto_depIdxs = nil +} diff --git a/protogen/example/ms/ms_grpc.pb.go b/protogen/example/ms/ms_grpc.pb.go new file mode 100644 index 00000000..8b55e279 --- /dev/null +++ b/protogen/example/ms/ms_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.1 +// source: ms/ms.proto + +package ms + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + MicroService_SayHello_FullMethodName = "/ms.MicroService/SayHello" +) + +// MicroServiceClient is the client API for MicroService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type MicroServiceClient interface { + SayHello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Reply, error) +} + +type microServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewMicroServiceClient(cc grpc.ClientConnInterface) MicroServiceClient { + return µServiceClient{cc} +} + +func (c *microServiceClient) SayHello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Reply, error) { + out := new(Reply) + err := c.cc.Invoke(ctx, MicroService_SayHello_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MicroServiceServer is the server API for MicroService service. +// All implementations must embed UnimplementedMicroServiceServer +// for forward compatibility +type MicroServiceServer interface { + SayHello(context.Context, *Request) (*Reply, error) + mustEmbedUnimplementedMicroServiceServer() +} + +// UnimplementedMicroServiceServer must be embedded to have forward compatible implementations. +type UnimplementedMicroServiceServer struct { +} + +func (UnimplementedMicroServiceServer) SayHello(context.Context, *Request) (*Reply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") +} +func (UnimplementedMicroServiceServer) mustEmbedUnimplementedMicroServiceServer() {} + +// UnsafeMicroServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MicroServiceServer will +// result in compilation errors. +type UnsafeMicroServiceServer interface { + mustEmbedUnimplementedMicroServiceServer() +} + +func RegisterMicroServiceServer(s grpc.ServiceRegistrar, srv MicroServiceServer) { + s.RegisterService(&MicroService_ServiceDesc, srv) +} + +func _MicroService_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MicroServiceServer).SayHello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MicroService_SayHello_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MicroServiceServer).SayHello(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +// MicroService_ServiceDesc is the grpc.ServiceDesc for MicroService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MicroService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ms.MicroService", + HandlerType: (*MicroServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _MicroService_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ms/ms.proto", +} diff --git a/protogen/example/multi-files/file1.proto b/protogen/example/multi-files/file1.proto deleted file mode 100644 index c9d58e2b..00000000 --- a/protogen/example/multi-files/file1.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/multi-files"; - -package multifiles; - - -// The Gripmock service definition. -service Gripmock1 { - // simple unary method - rpc SayHello (Request1) returns (Reply1); -} - -// The request message containing the user's name. -message Request1 { - string name = 1; -} - -// The response message containing the greetings -message Reply1 { - string message = 1; - int32 return_code = 2; -} \ No newline at end of file diff --git a/protogen/example/multi-files/file2.proto b/protogen/example/multi-files/file2.proto deleted file mode 100644 index 31502f27..00000000 --- a/protogen/example/multi-files/file2.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/multi-files"; - -package multifiles; - - -service Gripmock2 { - // simple unary method - rpc SayHello (Request2) returns (Reply2); -} - -// The request message containing the user's name. -message Request2 { - string name = 1; -} - -// The response message containing the greetings -message Reply2 { - string message = 1; - int32 return_code = 2; -} \ No newline at end of file diff --git a/protogen/example/multi-package/bar/bar.proto b/protogen/example/multi-package/bar/bar.proto deleted file mode 100644 index 29a7710f..00000000 --- a/protogen/example/multi-package/bar/bar.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/multi-package/bar"; -package bar; - -// this go_package is simulating alias collision - - -message Bar{ - string name = 1; -} diff --git a/protogen/example/multi-package/foo.proto b/protogen/example/multi-package/foo.proto deleted file mode 100644 index b8d883d2..00000000 --- a/protogen/example/multi-package/foo.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/multi-package"; - -// simulating neighboring .proto file -// but different package -package foo; - -// simulating dummy private repo - - -message Response { - string response = 1; -} diff --git a/protogen/example/multi-package/hello.proto b/protogen/example/multi-package/hello.proto deleted file mode 100644 index 4081c0fe..00000000 --- a/protogen/example/multi-package/hello.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/multi-package"; - -package multi_package; - -import "bar/bar.proto"; -import "foo.proto"; - -// simulate no go_package and folder with - - -service Gripmock { - rpc Greet (bar.Bar) returns (foo.Response); -} - diff --git a/protogen/example/one-of/oneof.proto b/protogen/example/one-of/oneof.proto deleted file mode 100644 index 72ec4bc9..00000000 --- a/protogen/example/one-of/oneof.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/one-of"; - -package oneof; - - - -// The Gripmock service definition. -service Gripmock { - // simple unary method - rpc SayHello (Request) returns (Reply); -} - -// The request message containing the user's name. -message Request { - string name = 1; -} - -message Reply { - oneof replyType { - Reply1 reply1 = 1; - Reply2 reply2 = 2; - } -} - -// usual response type -message Reply1 { - string message = 1; - int32 return_code = 2; -} - -// other response type -message Reply2 { - int32 other = 1; -} \ No newline at end of file diff --git a/protogen/example/simple/simple.proto b/protogen/example/simple/simple.proto deleted file mode 100644 index fbed9cca..00000000 --- a/protogen/example/simple/simple.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/simple"; - -package simple; - - - -// The Gripmock service definition. -service Gripmock { - // simple unary method - rpc SayHello (Request) returns (Reply); -} - -// The request message containing the user's name. -message Request { - string name = 1; -} - -// The response message containing the greetings -message Reply { - string message = 1; - int32 return_code = 2; -} \ No newline at end of file diff --git a/protogen/example/stream/stream.proto b/protogen/example/stream/stream.proto deleted file mode 100644 index 20d10598..00000000 --- a/protogen/example/stream/stream.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/stream"; - -package stream; - - -// The Gripmock service definition. -service Gripmock { - // server to client sreaming - rpc serverStream (Request) returns (stream Reply); - // client to server streaming - rpc clientStream (stream Request) returns (Reply); - // bidirectional streaming - rpc bidirectional (stream Request) returns (stream Reply); -} - -// The request message containing the user's name. -message Request { - string name = 1; -} - -// The response message containing the greetings -message Reply { - string message = 1; -} \ No newline at end of file diff --git a/protogen/example/stub-subfolders/stub-subfolders.proto b/protogen/example/stub-subfolders/stub-subfolders.proto deleted file mode 100644 index 50df5acc..00000000 --- a/protogen/example/stub-subfolders/stub-subfolders.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/stub-subfolders"; - -package stub_subfolders; - -// The Gripmock service definition. -service Gripmock { - // simple unary method - rpc SayHello (Request) returns (Reply); -} - -// The request message containing the user's name. -message Request { - string name = 1; -} - -// The response message containing the greetings -message Reply { - string message = 1; - int32 return_code = 2; -} \ No newline at end of file diff --git a/protogen/example/well_known_types/wkt.proto b/protogen/example/well_known_types/wkt.proto deleted file mode 100644 index 6fb7a77f..00000000 --- a/protogen/example/well_known_types/wkt.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/bavix/gripmock/protogen/example/well_known_types"; - -package well_known_types; - -import "google/protobuf/empty.proto"; -import "google/protobuf/api.proto"; - - -service Gripmock { - // this shows us example on using WKT as dependency - // api.proto in particular has go_package alias with semicolon - // "google.golang.org/genproto/protobuf/api;api" - rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api); -} From ee2b4af758359675200bbac98939c9cb0d888947 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 21:44:54 +0300 Subject: [PATCH 3/6] [2.6] fix TestWriterWrapper_OptionUpdate --- internal/pkg/patcher/writer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/patcher/writer_test.go b/internal/pkg/patcher/writer_test.go index c3e4506c..678e74b5 100644 --- a/internal/pkg/patcher/writer_test.go +++ b/internal/pkg/patcher/writer_test.go @@ -13,7 +13,7 @@ import ( func TestWriterWrapper_OptionUpdate(t *testing.T) { pile, err := os.OpenFile( - "./../../../protogen/example/multi-files/file1.proto", + "./../../../example/multi-files/file1.proto", os.O_RDONLY, 0o444, ) From 2b0f49440e71327c7c5dbba71dd14ce0818a8c1e Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 22:52:03 +0300 Subject: [PATCH 4/6] [2.6] fix units --- internal/app/storage.go | 18 +-- pkg/storage/stubs.go | 56 +++++++-- protogen/example/multi-package/hello.pb.go | 76 ------------ .../example/multi-package/hello_grpc.pb.go | 110 ------------------ 4 files changed, 55 insertions(+), 205 deletions(-) delete mode 100644 protogen/example/multi-package/hello.pb.go delete mode 100644 protogen/example/multi-package/hello_grpc.pb.go diff --git a/internal/app/storage.go b/internal/app/storage.go index 5a4bad39..c1dc5114 100644 --- a/internal/app/storage.go +++ b/internal/app/storage.go @@ -54,7 +54,7 @@ func findStub(stubStorage *storage.StubStorage, stub *findStubPayload) (*storage var closestMatch []closeMatch for _, strange := range stubs { - cmpData, cmpDataErr := inputCmp(strange.Input, stub.Data) + cmpData, cmpDataErr := inputCmp(strange.Input, stub.Data, strange.Input.IgnoreArrayOrder) if cmpDataErr != nil { if cmpData != nil { closestMatch = append(closestMatch, *cmpData) @@ -64,7 +64,7 @@ func findStub(stubStorage *storage.StubStorage, stub *findStubPayload) (*storage } if strange.CheckHeaders() { - if cmpHeaders, cmpHeadersErr := inputCmp(strange.Headers, stub.Headers); cmpHeadersErr != nil { + if cmpHeaders, cmpHeadersErr := inputCmp(strange.Headers, stub.Headers, false); cmpHeadersErr != nil { if cmpHeaders != nil { closestMatch = append(closestMatch, closeMatch{ rule: cmpData.rule, @@ -86,31 +86,31 @@ func findStub(stubStorage *storage.StubStorage, stub *findStubPayload) (*storage return nil, stubNotFoundError(stub, closestMatch) } -func inputCmp(input storage.Input, data map[string]interface{}) (*closeMatch, error) { - if expect := input.Equals; expect != nil { +func inputCmp(input storage.InputInterface, data map[string]interface{}, ignoreArrayOrder bool) (*closeMatch, error) { + if expect := input.GetEquals(); expect != nil { closeMatchVal := closeMatch{rule: "equals", expect: expect} - if equals(input.Equals, data, input.IgnoreArrayOrder) { + if equals(input.GetEquals(), data, ignoreArrayOrder) { return &closeMatchVal, nil } return &closeMatchVal, ErrNotFound } - if expect := input.Contains; expect != nil { + if expect := input.GetContains(); expect != nil { closeMatchVal := closeMatch{rule: "contains", expect: expect} - if contains(input.Contains, data, input.IgnoreArrayOrder) { + if contains(input.GetContains(), data, ignoreArrayOrder) { return &closeMatchVal, nil } return &closeMatchVal, ErrNotFound } - if expect := input.Matches; expect != nil { + if expect := input.GetMatches(); expect != nil { closeMatchVal := closeMatch{rule: "matches", expect: expect} - if matches(input.Matches, data, input.IgnoreArrayOrder) { + if matches(input.GetMatches(), data, ignoreArrayOrder) { return &closeMatchVal, nil } diff --git a/pkg/storage/stubs.go b/pkg/storage/stubs.go index 3852870a..db3e539c 100644 --- a/pkg/storage/stubs.go +++ b/pkg/storage/stubs.go @@ -17,12 +17,12 @@ var ( ) type Stub struct { - ID *uuid.UUID `json:"id,omitempty"` - Service string `json:"service"` - Method string `json:"method"` - Headers Input `json:"headers"` - Input Input `json:"input"` - Output Output `json:"output"` + ID *uuid.UUID `json:"id,omitempty"` + Service string `json:"service"` + Method string `json:"method"` + Headers InputHeader `json:"headers"` + Input InputData `json:"input"` + Output Output `json:"output"` } func (s *Stub) GetID() uuid.UUID { @@ -34,13 +34,49 @@ func (s *Stub) GetID() uuid.UUID { return *s.ID } -type Input struct { - IgnoreArrayOrder bool `json:"ignoreArrayOrder"` +type InputInterface interface { + GetEquals() map[string]interface{} + GetContains() map[string]interface{} + GetMatches() map[string]interface{} +} + +type InputData struct { + IgnoreArrayOrder bool `json:"ignoreArrayOrder,omitempty"` Equals map[string]interface{} `json:"equals"` Contains map[string]interface{} `json:"contains"` Matches map[string]interface{} `json:"matches"` } +func (i InputData) GetEquals() map[string]interface{} { + return i.Equals +} + +func (i InputData) GetContains() map[string]interface{} { + return i.Contains +} + +func (i InputData) GetMatches() map[string]interface{} { + return i.Matches +} + +type InputHeader struct { + Equals map[string]interface{} `json:"equals"` + Contains map[string]interface{} `json:"contains"` + Matches map[string]interface{} `json:"matches"` +} + +func (i InputHeader) GetEquals() map[string]interface{} { + return i.Equals +} + +func (i InputHeader) GetContains() map[string]interface{} { + return i.Contains +} + +func (i InputHeader) GetMatches() map[string]interface{} { + return i.Matches +} + type Output struct { Headers map[string]string `json:"headers"` Data map[string]interface{} `json:"data"` @@ -50,8 +86,8 @@ type Output struct { type storage struct { ID uuid.UUID - Headers Input - Input Input + Headers InputHeader + Input InputData Output Output } diff --git a/protogen/example/multi-package/hello.pb.go b/protogen/example/multi-package/hello.pb.go deleted file mode 100644 index 519bb44a..00000000 --- a/protogen/example/multi-package/hello.pb.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 -// source: hello.proto - -package multi_package - -import ( - bar "github.com/bavix/gripmock/protogen/example/multi-package/bar" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_hello_proto protoreflect.FileDescriptor - -var file_hello_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x1a, 0x0d, 0x62, 0x61, - 0x72, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x09, 0x66, 0x6f, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x2c, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, - 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x08, 0x2e, 0x62, 0x61, - 0x72, 0x2e, 0x42, 0x61, 0x72, 0x1a, 0x0d, 0x2e, 0x66, 0x6f, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, - 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_hello_proto_goTypes = []interface{}{ - (*bar.Bar)(nil), // 0: bar.Bar - (*Response)(nil), // 1: foo.Response -} -var file_hello_proto_depIdxs = []int32{ - 0, // 0: multi_package.Gripmock.Greet:input_type -> bar.Bar - 1, // 1: multi_package.Gripmock.Greet:output_type -> foo.Response - 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_hello_proto_init() } -func file_hello_proto_init() { - if File_hello_proto != nil { - return - } - file_foo_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_hello_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_hello_proto_goTypes, - DependencyIndexes: file_hello_proto_depIdxs, - }.Build() - File_hello_proto = out.File - file_hello_proto_rawDesc = nil - file_hello_proto_goTypes = nil - file_hello_proto_depIdxs = nil -} diff --git a/protogen/example/multi-package/hello_grpc.pb.go b/protogen/example/multi-package/hello_grpc.pb.go deleted file mode 100644 index e1de979a..00000000 --- a/protogen/example/multi-package/hello_grpc.pb.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: hello.proto - -package multi_package - -import ( - context "context" - bar "github.com/bavix/gripmock/protogen/example/multi-package/bar" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Gripmock_Greet_FullMethodName = "/multi_package.Gripmock/Greet" -) - -// GripmockClient is the client API for Gripmock service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type GripmockClient interface { - Greet(ctx context.Context, in *bar.Bar, opts ...grpc.CallOption) (*Response, error) -} - -type gripmockClient struct { - cc grpc.ClientConnInterface -} - -func NewGripmockClient(cc grpc.ClientConnInterface) GripmockClient { - return &gripmockClient{cc} -} - -func (c *gripmockClient) Greet(ctx context.Context, in *bar.Bar, opts ...grpc.CallOption) (*Response, error) { - out := new(Response) - err := c.cc.Invoke(ctx, Gripmock_Greet_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// GripmockServer is the server API for Gripmock service. -// All implementations must embed UnimplementedGripmockServer -// for forward compatibility -type GripmockServer interface { - Greet(context.Context, *bar.Bar) (*Response, error) - mustEmbedUnimplementedGripmockServer() -} - -// UnimplementedGripmockServer must be embedded to have forward compatible implementations. -type UnimplementedGripmockServer struct { -} - -func (UnimplementedGripmockServer) Greet(context.Context, *bar.Bar) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented") -} -func (UnimplementedGripmockServer) mustEmbedUnimplementedGripmockServer() {} - -// UnsafeGripmockServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to GripmockServer will -// result in compilation errors. -type UnsafeGripmockServer interface { - mustEmbedUnimplementedGripmockServer() -} - -func RegisterGripmockServer(s grpc.ServiceRegistrar, srv GripmockServer) { - s.RegisterService(&Gripmock_ServiceDesc, srv) -} - -func _Gripmock_Greet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(bar.Bar) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(GripmockServer).Greet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Gripmock_Greet_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GripmockServer).Greet(ctx, req.(*bar.Bar)) - } - return interceptor(ctx, in, info, handler) -} - -// Gripmock_ServiceDesc is the grpc.ServiceDesc for Gripmock service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Gripmock_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "multi_package.Gripmock", - HandlerType: (*GripmockServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Greet", - Handler: _Gripmock_Greet_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "hello.proto", -} From 4c5442682e360314d9adb05012315acad65d6730 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 22:54:15 +0300 Subject: [PATCH 5/6] [2.6] add new entrypoint --- .github/workflows/integration-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 5aba140f..33ba356a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -41,3 +41,7 @@ jobs: uses: ./ with: entrypoint: example/stub-subfolders/entrypoint.sh + - name: Run microservice example + uses: ./ + with: + entrypoint: example/ms/entrypoint.sh From a672bf34d14e867ad5d14244c560ef1fa63c57c5 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Fri, 12 Jan 2024 22:59:10 +0300 Subject: [PATCH 6/6] [2.6] autogenerate --- deployments/docker-compose/docker-compose.yml | 38 +++-- protogen/example/ms/ms.pb.go | 91 ++++++------ protogen/example/ms/ms.proto | 18 +++ protogen/example/ms/ms_grpc.pb.go | 6 +- protogen/example/multi-files/file1.pb.go | 102 ++++++------- protogen/example/multi-files/file1.proto | 21 +++ protogen/example/multi-files/file1_grpc.pb.go | 6 +- protogen/example/multi-files/file2.pb.go | 102 ++++++------- protogen/example/multi-files/file2.proto | 20 +++ protogen/example/multi-files/file2_grpc.pb.go | 6 +- protogen/example/multi-package/bar/bar.pb.go | 79 +++++------ protogen/example/multi-package/bar/bar.proto | 9 ++ protogen/example/multi-package/foo.pb.go | 76 +++++----- protogen/example/multi-package/foo.proto | 12 ++ protogen/example/multi-package/hello.pb.go | 76 ++++++++++ protogen/example/multi-package/hello.proto | 14 ++ .../example/multi-package/hello_grpc.pb.go | 110 ++++++++++++++ protogen/example/one-of/oneof.pb.go | 134 +++++++++--------- protogen/example/one-of/oneof.proto | 34 +++++ protogen/example/one-of/oneof_grpc.pb.go | 6 +- protogen/example/simple/simple.pb.go | 112 +++++++-------- protogen/example/simple/simple.proto | 27 ++++ protogen/example/simple/simple_grpc.pb.go | 6 +- protogen/example/stream/stream.pb.go | 108 +++++++------- protogen/example/stream/stream.proto | 24 ++++ protogen/example/stream/stream_grpc.pb.go | 6 +- .../stub-subfolders/stub-subfolders.pb.go | 14 +- .../stub-subfolders/stub-subfolders.proto | 21 +++ .../stub-subfolders_grpc.pb.go | 2 +- protogen/example/well_known_types/wkt.pb.go | 37 ++--- protogen/example/well_known_types/wkt.proto | 20 +++ .../example/well_known_types/wkt_grpc.pb.go | 2 +- 32 files changed, 883 insertions(+), 456 deletions(-) create mode 100644 protogen/example/ms/ms.proto create mode 100644 protogen/example/multi-files/file1.proto create mode 100644 protogen/example/multi-files/file2.proto create mode 100644 protogen/example/multi-package/bar/bar.proto create mode 100644 protogen/example/multi-package/foo.proto create mode 100644 protogen/example/multi-package/hello.pb.go create mode 100644 protogen/example/multi-package/hello.proto create mode 100644 protogen/example/multi-package/hello_grpc.pb.go create mode 100644 protogen/example/one-of/oneof.proto create mode 100644 protogen/example/simple/simple.proto create mode 100644 protogen/example/stream/stream.proto create mode 100644 protogen/example/stub-subfolders/stub-subfolders.proto create mode 100644 protogen/example/well_known_types/wkt.proto diff --git a/deployments/docker-compose/docker-compose.yml b/deployments/docker-compose/docker-compose.yml index 237fb829..e617f033 100644 --- a/deployments/docker-compose/docker-compose.yml +++ b/deployments/docker-compose/docker-compose.yml @@ -3,24 +3,40 @@ services: ms: image: bavix/gripmock:latest entrypoint: example/ms/entrypoint.sh - simple: - image: bavix/gripmock:latest - entrypoint: example/simple/entrypoint.sh - stream: - image: bavix/gripmock:latest - entrypoint: example/stream/entrypoint.sh - well_known_types: + volumes: + - ./../../protogen/example/ms:/go/src/github.com/bavix/gripmock/protogen/example/ms + multi-files: image: bavix/gripmock:latest - entrypoint: example/well_known_types/entrypoint.sh + entrypoint: example/multi-files/entrypoint.sh + volumes: + - ./../../protogen/example/multi-files:/go/src/github.com/bavix/gripmock/protogen/example/multi-files multi-package: image: bavix/gripmock:latest entrypoint: example/multi-package/entrypoint.sh - multi-files: - image: bavix/gripmock:latest - entrypoint: example/multi-files/entrypoint.sh + volumes: + - ./../../protogen/example/multi-package:/go/src/github.com/bavix/gripmock/protogen/example/multi-package one-of: image: bavix/gripmock:latest entrypoint: example/one-of/entrypoint.sh + volumes: + - ./../../protogen/example/one-of:/go/src/github.com/bavix/gripmock/protogen/example/one-of + simple: + image: bavix/gripmock:latest + entrypoint: example/simple/entrypoint.sh + volumes: + - ./../../protogen/example/simple:/go/src/github.com/bavix/gripmock/protogen/example/simple + stream: + image: bavix/gripmock:latest + entrypoint: example/stream/entrypoint.sh + volumes: + - ./../../protogen/example/stream:/go/src/github.com/bavix/gripmock/protogen/example/stream stub-subfolders: image: bavix/gripmock:latest entrypoint: example/stub-subfolders/entrypoint.sh + volumes: + - ./../../protogen/example/stub-subfolders:/go/src/github.com/bavix/gripmock/protogen/example/stub-subfolders + well_known_types: + image: bavix/gripmock:latest + entrypoint: example/well_known_types/entrypoint.sh + volumes: + - ./../../protogen/example/well_known_types:/go/src/github.com/bavix/gripmock/protogen/example/well_known_types diff --git a/protogen/example/ms/ms.pb.go b/protogen/example/ms/ms.pb.go index c8c627fb..40d26b6d 100644 --- a/protogen/example/ms/ms.pb.go +++ b/protogen/example/ms/ms.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: ms/ms.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: ms.proto package ms @@ -32,7 +32,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_ms_ms_proto_msgTypes[0] + mi := &file_ms_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_ms_ms_proto_msgTypes[0] + mi := &file_ms_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 *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_ms_ms_proto_rawDescGZIP(), []int{0} + return file_ms_proto_rawDescGZIP(), []int{0} } func (x *Request) GetV1() [][]byte { @@ -86,7 +86,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_ms_ms_proto_msgTypes[1] + mi := &file_ms_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99,7 +99,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_ms_ms_proto_msgTypes[1] + mi := &file_ms_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112,7 +112,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_ms_ms_proto_rawDescGZIP(), []int{1} + return file_ms_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetCode() int64 { @@ -122,41 +122,42 @@ func (x *Reply) GetCode() int64 { return 0 } -var File_ms_ms_proto protoreflect.FileDescriptor +var File_ms_proto protoreflect.FileDescriptor -var file_ms_ms_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x6d, 0x73, 0x2f, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x6d, - 0x73, 0x22, 0x29, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x76, 0x31, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02, 0x76, 0x31, 0x12, 0x0e, 0x0a, 0x02, - 0x76, 0x32, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x76, 0x32, 0x22, 0x1b, 0x0a, 0x05, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x32, 0x32, 0x0a, 0x0c, 0x4d, 0x69, 0x63, - 0x72, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x08, 0x53, 0x61, 0x79, - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0b, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x26, 0x5a, - 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, - 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_ms_proto_rawDesc = []byte{ + 0x0a, 0x08, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x6d, 0x73, 0x22, 0x29, + 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x76, 0x31, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02, 0x76, 0x31, 0x12, 0x0e, 0x0a, 0x02, 0x76, 0x32, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x76, 0x32, 0x22, 0x1b, 0x0a, 0x05, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x32, 0x32, 0x0a, 0x0c, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x12, 0x0b, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x09, 0x2e, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, + 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, + 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_ms_ms_proto_rawDescOnce sync.Once - file_ms_ms_proto_rawDescData = file_ms_ms_proto_rawDesc + file_ms_proto_rawDescOnce sync.Once + file_ms_proto_rawDescData = file_ms_proto_rawDesc ) -func file_ms_ms_proto_rawDescGZIP() []byte { - file_ms_ms_proto_rawDescOnce.Do(func() { - file_ms_ms_proto_rawDescData = protoimpl.X.CompressGZIP(file_ms_ms_proto_rawDescData) +func file_ms_proto_rawDescGZIP() []byte { + file_ms_proto_rawDescOnce.Do(func() { + file_ms_proto_rawDescData = protoimpl.X.CompressGZIP(file_ms_proto_rawDescData) }) - return file_ms_ms_proto_rawDescData + return file_ms_proto_rawDescData } -var file_ms_ms_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_ms_ms_proto_goTypes = []interface{}{ +var file_ms_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ms_proto_goTypes = []interface{}{ (*Request)(nil), // 0: ms.Request (*Reply)(nil), // 1: ms.Reply } -var file_ms_ms_proto_depIdxs = []int32{ +var file_ms_proto_depIdxs = []int32{ 0, // 0: ms.MicroService.SayHello:input_type -> ms.Request 1, // 1: ms.MicroService.SayHello:output_type -> ms.Reply 1, // [1:2] is the sub-list for method output_type @@ -166,13 +167,13 @@ var file_ms_ms_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_ms_ms_proto_init() } -func file_ms_ms_proto_init() { - if File_ms_ms_proto != nil { +func init() { file_ms_proto_init() } +func file_ms_proto_init() { + if File_ms_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_ms_ms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_ms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -184,7 +185,7 @@ func file_ms_ms_proto_init() { return nil } } - file_ms_ms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_ms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -201,18 +202,18 @@ func file_ms_ms_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_ms_ms_proto_rawDesc, + RawDescriptor: file_ms_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_ms_ms_proto_goTypes, - DependencyIndexes: file_ms_ms_proto_depIdxs, - MessageInfos: file_ms_ms_proto_msgTypes, + GoTypes: file_ms_proto_goTypes, + DependencyIndexes: file_ms_proto_depIdxs, + MessageInfos: file_ms_proto_msgTypes, }.Build() - File_ms_ms_proto = out.File - file_ms_ms_proto_rawDesc = nil - file_ms_ms_proto_goTypes = nil - file_ms_ms_proto_depIdxs = nil + File_ms_proto = out.File + file_ms_proto_rawDesc = nil + file_ms_proto_goTypes = nil + file_ms_proto_depIdxs = nil } diff --git a/protogen/example/ms/ms.proto b/protogen/example/ms/ms.proto new file mode 100644 index 00000000..030f29a7 --- /dev/null +++ b/protogen/example/ms/ms.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ms; + +option go_package = "github.com/bavix/gripmock/protogen/example/ms"; + +service MicroService { + rpc SayHello (Request) returns (Reply); +} + +message Request { + repeated bytes v1 = 1; + repeated string v2 = 2; +} + +message Reply { + int64 code = 1; +} diff --git a/protogen/example/ms/ms_grpc.pb.go b/protogen/example/ms/ms_grpc.pb.go index 8b55e279..091f1372 100644 --- a/protogen/example/ms/ms_grpc.pb.go +++ b/protogen/example/ms/ms_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: ms/ms.proto +// - protoc v4.24.4 +// source: ms.proto package ms @@ -105,5 +105,5 @@ var MicroService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "ms/ms.proto", + Metadata: "ms.proto", } diff --git a/protogen/example/multi-files/file1.pb.go b/protogen/example/multi-files/file1.pb.go index 75f71a4d..d7785056 100644 --- a/protogen/example/multi-files/file1.pb.go +++ b/protogen/example/multi-files/file1.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: multi-files/file1.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: file1.proto package multi_files @@ -32,7 +32,7 @@ type Request1 struct { func (x *Request1) Reset() { *x = Request1{} if protoimpl.UnsafeEnabled { - mi := &file_multi_files_file1_proto_msgTypes[0] + mi := &file_file1_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request1) String() string { func (*Request1) ProtoMessage() {} func (x *Request1) ProtoReflect() protoreflect.Message { - mi := &file_multi_files_file1_proto_msgTypes[0] + mi := &file_file1_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 *Request1) ProtoReflect() protoreflect.Message { // Deprecated: Use Request1.ProtoReflect.Descriptor instead. func (*Request1) Descriptor() ([]byte, []int) { - return file_multi_files_file1_proto_rawDescGZIP(), []int{0} + return file_file1_proto_rawDescGZIP(), []int{0} } func (x *Request1) GetName() string { @@ -81,7 +81,7 @@ type Reply1 struct { func (x *Reply1) Reset() { *x = Reply1{} if protoimpl.UnsafeEnabled { - mi := &file_multi_files_file1_proto_msgTypes[1] + mi := &file_file1_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *Reply1) String() string { func (*Reply1) ProtoMessage() {} func (x *Reply1) ProtoReflect() protoreflect.Message { - mi := &file_multi_files_file1_proto_msgTypes[1] + mi := &file_file1_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *Reply1) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply1.ProtoReflect.Descriptor instead. func (*Reply1) Descriptor() ([]byte, []int) { - return file_multi_files_file1_proto_rawDescGZIP(), []int{1} + return file_file1_proto_rawDescGZIP(), []int{1} } func (x *Reply1) GetMessage() string { @@ -124,46 +124,46 @@ func (x *Reply1) GetReturnCode() int32 { return 0 } -var File_multi_files_file1_proto protoreflect.FileDescriptor - -var file_multi_files_file1_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, - 0x6c, 0x65, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, 0x0a, 0x09, 0x47, 0x72, - 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x31, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, - 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x31, 0x1a, 0x12, 0x2e, 0x6d, 0x75, 0x6c, 0x74, - 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x42, 0x2f, 0x5a, - 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, - 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_file1_proto protoreflect.FileDescriptor + +var file_file1_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, + 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, + 0x0a, 0x09, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x31, 0x12, 0x34, 0x0a, 0x08, 0x53, + 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x31, 0x1a, 0x12, 0x2e, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x31, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_multi_files_file1_proto_rawDescOnce sync.Once - file_multi_files_file1_proto_rawDescData = file_multi_files_file1_proto_rawDesc + file_file1_proto_rawDescOnce sync.Once + file_file1_proto_rawDescData = file_file1_proto_rawDesc ) -func file_multi_files_file1_proto_rawDescGZIP() []byte { - file_multi_files_file1_proto_rawDescOnce.Do(func() { - file_multi_files_file1_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_files_file1_proto_rawDescData) +func file_file1_proto_rawDescGZIP() []byte { + file_file1_proto_rawDescOnce.Do(func() { + file_file1_proto_rawDescData = protoimpl.X.CompressGZIP(file_file1_proto_rawDescData) }) - return file_multi_files_file1_proto_rawDescData + return file_file1_proto_rawDescData } -var file_multi_files_file1_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_multi_files_file1_proto_goTypes = []interface{}{ +var file_file1_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_file1_proto_goTypes = []interface{}{ (*Request1)(nil), // 0: multifiles.Request1 (*Reply1)(nil), // 1: multifiles.Reply1 } -var file_multi_files_file1_proto_depIdxs = []int32{ +var file_file1_proto_depIdxs = []int32{ 0, // 0: multifiles.Gripmock1.SayHello:input_type -> multifiles.Request1 1, // 1: multifiles.Gripmock1.SayHello:output_type -> multifiles.Reply1 1, // [1:2] is the sub-list for method output_type @@ -173,13 +173,13 @@ var file_multi_files_file1_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_multi_files_file1_proto_init() } -func file_multi_files_file1_proto_init() { - if File_multi_files_file1_proto != nil { +func init() { file_file1_proto_init() } +func file_file1_proto_init() { + if File_file1_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_multi_files_file1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_file1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request1); i { case 0: return &v.state @@ -191,7 +191,7 @@ func file_multi_files_file1_proto_init() { return nil } } - file_multi_files_file1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_file1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply1); i { case 0: return &v.state @@ -208,18 +208,18 @@ func file_multi_files_file1_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_multi_files_file1_proto_rawDesc, + RawDescriptor: file_file1_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_multi_files_file1_proto_goTypes, - DependencyIndexes: file_multi_files_file1_proto_depIdxs, - MessageInfos: file_multi_files_file1_proto_msgTypes, + GoTypes: file_file1_proto_goTypes, + DependencyIndexes: file_file1_proto_depIdxs, + MessageInfos: file_file1_proto_msgTypes, }.Build() - File_multi_files_file1_proto = out.File - file_multi_files_file1_proto_rawDesc = nil - file_multi_files_file1_proto_goTypes = nil - file_multi_files_file1_proto_depIdxs = nil + File_file1_proto = out.File + file_file1_proto_rawDesc = nil + file_file1_proto_goTypes = nil + file_file1_proto_depIdxs = nil } diff --git a/protogen/example/multi-files/file1.proto b/protogen/example/multi-files/file1.proto new file mode 100644 index 00000000..3a2c30b3 --- /dev/null +++ b/protogen/example/multi-files/file1.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package multifiles; + +option go_package = "github.com/bavix/gripmock/protogen/example/multi-files"; +// The Gripmock service definition. +service Gripmock1 { + // simple unary method + rpc SayHello (Request1) returns (Reply1); +} + +// The request message containing the user's name. +message Request1 { + string name = 1; +} + +// The response message containing the greetings +message Reply1 { + string message = 1; + int32 return_code = 2; +} \ No newline at end of file diff --git a/protogen/example/multi-files/file1_grpc.pb.go b/protogen/example/multi-files/file1_grpc.pb.go index c03c8cee..edf9b303 100644 --- a/protogen/example/multi-files/file1_grpc.pb.go +++ b/protogen/example/multi-files/file1_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: multi-files/file1.proto +// - protoc v4.24.4 +// source: file1.proto package multi_files @@ -107,5 +107,5 @@ var Gripmock1_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "multi-files/file1.proto", + Metadata: "file1.proto", } diff --git a/protogen/example/multi-files/file2.pb.go b/protogen/example/multi-files/file2.pb.go index 10675b42..d2167d4c 100644 --- a/protogen/example/multi-files/file2.pb.go +++ b/protogen/example/multi-files/file2.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: multi-files/file2.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: file2.proto package multi_files @@ -32,7 +32,7 @@ type Request2 struct { func (x *Request2) Reset() { *x = Request2{} if protoimpl.UnsafeEnabled { - mi := &file_multi_files_file2_proto_msgTypes[0] + mi := &file_file2_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request2) String() string { func (*Request2) ProtoMessage() {} func (x *Request2) ProtoReflect() protoreflect.Message { - mi := &file_multi_files_file2_proto_msgTypes[0] + mi := &file_file2_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 *Request2) ProtoReflect() protoreflect.Message { // Deprecated: Use Request2.ProtoReflect.Descriptor instead. func (*Request2) Descriptor() ([]byte, []int) { - return file_multi_files_file2_proto_rawDescGZIP(), []int{0} + return file_file2_proto_rawDescGZIP(), []int{0} } func (x *Request2) GetName() string { @@ -81,7 +81,7 @@ type Reply2 struct { func (x *Reply2) Reset() { *x = Reply2{} if protoimpl.UnsafeEnabled { - mi := &file_multi_files_file2_proto_msgTypes[1] + mi := &file_file2_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *Reply2) String() string { func (*Reply2) ProtoMessage() {} func (x *Reply2) ProtoReflect() protoreflect.Message { - mi := &file_multi_files_file2_proto_msgTypes[1] + mi := &file_file2_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *Reply2) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply2.ProtoReflect.Descriptor instead. func (*Reply2) Descriptor() ([]byte, []int) { - return file_multi_files_file2_proto_rawDescGZIP(), []int{1} + return file_file2_proto_rawDescGZIP(), []int{1} } func (x *Reply2) GetMessage() string { @@ -124,46 +124,46 @@ func (x *Reply2) GetReturnCode() int32 { return 0 } -var File_multi_files_file2_proto protoreflect.FileDescriptor - -var file_multi_files_file2_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, - 0x6c, 0x65, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x32, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, 0x0a, 0x09, 0x47, 0x72, - 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x32, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, - 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x1a, 0x12, 0x2e, 0x6d, 0x75, 0x6c, 0x74, - 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x2f, 0x5a, - 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, - 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_file2_proto protoreflect.FileDescriptor + +var file_file2_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x32, 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, 0x12, 0x1f, 0x0a, + 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x41, + 0x0a, 0x09, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x32, 0x12, 0x34, 0x0a, 0x08, 0x53, + 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x14, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x1a, 0x12, 0x2e, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x32, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_multi_files_file2_proto_rawDescOnce sync.Once - file_multi_files_file2_proto_rawDescData = file_multi_files_file2_proto_rawDesc + file_file2_proto_rawDescOnce sync.Once + file_file2_proto_rawDescData = file_file2_proto_rawDesc ) -func file_multi_files_file2_proto_rawDescGZIP() []byte { - file_multi_files_file2_proto_rawDescOnce.Do(func() { - file_multi_files_file2_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_files_file2_proto_rawDescData) +func file_file2_proto_rawDescGZIP() []byte { + file_file2_proto_rawDescOnce.Do(func() { + file_file2_proto_rawDescData = protoimpl.X.CompressGZIP(file_file2_proto_rawDescData) }) - return file_multi_files_file2_proto_rawDescData + return file_file2_proto_rawDescData } -var file_multi_files_file2_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_multi_files_file2_proto_goTypes = []interface{}{ +var file_file2_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_file2_proto_goTypes = []interface{}{ (*Request2)(nil), // 0: multifiles.Request2 (*Reply2)(nil), // 1: multifiles.Reply2 } -var file_multi_files_file2_proto_depIdxs = []int32{ +var file_file2_proto_depIdxs = []int32{ 0, // 0: multifiles.Gripmock2.SayHello:input_type -> multifiles.Request2 1, // 1: multifiles.Gripmock2.SayHello:output_type -> multifiles.Reply2 1, // [1:2] is the sub-list for method output_type @@ -173,13 +173,13 @@ var file_multi_files_file2_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_multi_files_file2_proto_init() } -func file_multi_files_file2_proto_init() { - if File_multi_files_file2_proto != nil { +func init() { file_file2_proto_init() } +func file_file2_proto_init() { + if File_file2_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_multi_files_file2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_file2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request2); i { case 0: return &v.state @@ -191,7 +191,7 @@ func file_multi_files_file2_proto_init() { return nil } } - file_multi_files_file2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_file2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply2); i { case 0: return &v.state @@ -208,18 +208,18 @@ func file_multi_files_file2_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_multi_files_file2_proto_rawDesc, + RawDescriptor: file_file2_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_multi_files_file2_proto_goTypes, - DependencyIndexes: file_multi_files_file2_proto_depIdxs, - MessageInfos: file_multi_files_file2_proto_msgTypes, + GoTypes: file_file2_proto_goTypes, + DependencyIndexes: file_file2_proto_depIdxs, + MessageInfos: file_file2_proto_msgTypes, }.Build() - File_multi_files_file2_proto = out.File - file_multi_files_file2_proto_rawDesc = nil - file_multi_files_file2_proto_goTypes = nil - file_multi_files_file2_proto_depIdxs = nil + File_file2_proto = out.File + file_file2_proto_rawDesc = nil + file_file2_proto_goTypes = nil + file_file2_proto_depIdxs = nil } diff --git a/protogen/example/multi-files/file2.proto b/protogen/example/multi-files/file2.proto new file mode 100644 index 00000000..fa1c9df3 --- /dev/null +++ b/protogen/example/multi-files/file2.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package multifiles; + +option go_package = "github.com/bavix/gripmock/protogen/example/multi-files"; +service Gripmock2 { + // simple unary method + rpc SayHello (Request2) returns (Reply2); +} + +// The request message containing the user's name. +message Request2 { + string name = 1; +} + +// The response message containing the greetings +message Reply2 { + string message = 1; + int32 return_code = 2; +} \ No newline at end of file diff --git a/protogen/example/multi-files/file2_grpc.pb.go b/protogen/example/multi-files/file2_grpc.pb.go index bc9132e9..77735cdd 100644 --- a/protogen/example/multi-files/file2_grpc.pb.go +++ b/protogen/example/multi-files/file2_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: multi-files/file2.proto +// - protoc v4.24.4 +// source: file2.proto package multi_files @@ -107,5 +107,5 @@ var Gripmock2_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "multi-files/file2.proto", + Metadata: "file2.proto", } diff --git a/protogen/example/multi-package/bar/bar.pb.go b/protogen/example/multi-package/bar/bar.pb.go index f6538994..fa19e2fc 100644 --- a/protogen/example/multi-package/bar/bar.pb.go +++ b/protogen/example/multi-package/bar/bar.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: multi-package/bar/bar.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: bar/bar.proto -package multi_package +package bar import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -31,7 +31,7 @@ type Bar struct { func (x *Bar) Reset() { *x = Bar{} if protoimpl.UnsafeEnabled { - mi := &file_multi_package_bar_bar_proto_msgTypes[0] + mi := &file_bar_bar_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -44,7 +44,7 @@ func (x *Bar) String() string { func (*Bar) ProtoMessage() {} func (x *Bar) ProtoReflect() protoreflect.Message { - mi := &file_multi_package_bar_bar_proto_msgTypes[0] + mi := &file_bar_bar_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -57,7 +57,7 @@ func (x *Bar) ProtoReflect() protoreflect.Message { // Deprecated: Use Bar.ProtoReflect.Descriptor instead. func (*Bar) Descriptor() ([]byte, []int) { - return file_multi_package_bar_bar_proto_rawDescGZIP(), []int{0} + return file_bar_bar_proto_rawDescGZIP(), []int{0} } func (x *Bar) GetName() string { @@ -67,37 +67,36 @@ func (x *Bar) GetName() string { return "" } -var File_multi_package_bar_bar_proto protoreflect.FileDescriptor - -var file_multi_package_bar_bar_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, - 0x62, 0x61, 0x72, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x62, - 0x61, 0x72, 0x22, 0x19, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x43, 0x5a, - 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, - 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x2f, 0x62, 0x61, 0x72, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_bar_bar_proto protoreflect.FileDescriptor + +var file_bar_bar_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x62, 0x61, 0x72, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x03, 0x62, 0x61, 0x72, 0x22, 0x19, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, + 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x62, 0x61, 0x72, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_multi_package_bar_bar_proto_rawDescOnce sync.Once - file_multi_package_bar_bar_proto_rawDescData = file_multi_package_bar_bar_proto_rawDesc + file_bar_bar_proto_rawDescOnce sync.Once + file_bar_bar_proto_rawDescData = file_bar_bar_proto_rawDesc ) -func file_multi_package_bar_bar_proto_rawDescGZIP() []byte { - file_multi_package_bar_bar_proto_rawDescOnce.Do(func() { - file_multi_package_bar_bar_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_package_bar_bar_proto_rawDescData) +func file_bar_bar_proto_rawDescGZIP() []byte { + file_bar_bar_proto_rawDescOnce.Do(func() { + file_bar_bar_proto_rawDescData = protoimpl.X.CompressGZIP(file_bar_bar_proto_rawDescData) }) - return file_multi_package_bar_bar_proto_rawDescData + return file_bar_bar_proto_rawDescData } -var file_multi_package_bar_bar_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_multi_package_bar_bar_proto_goTypes = []interface{}{ +var file_bar_bar_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_bar_bar_proto_goTypes = []interface{}{ (*Bar)(nil), // 0: bar.Bar } -var file_multi_package_bar_bar_proto_depIdxs = []int32{ +var file_bar_bar_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 @@ -105,13 +104,13 @@ var file_multi_package_bar_bar_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_multi_package_bar_bar_proto_init() } -func file_multi_package_bar_bar_proto_init() { - if File_multi_package_bar_bar_proto != nil { +func init() { file_bar_bar_proto_init() } +func file_bar_bar_proto_init() { + if File_bar_bar_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_multi_package_bar_bar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_bar_bar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bar); i { case 0: return &v.state @@ -128,18 +127,18 @@ func file_multi_package_bar_bar_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_multi_package_bar_bar_proto_rawDesc, + RawDescriptor: file_bar_bar_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_multi_package_bar_bar_proto_goTypes, - DependencyIndexes: file_multi_package_bar_bar_proto_depIdxs, - MessageInfos: file_multi_package_bar_bar_proto_msgTypes, + GoTypes: file_bar_bar_proto_goTypes, + DependencyIndexes: file_bar_bar_proto_depIdxs, + MessageInfos: file_bar_bar_proto_msgTypes, }.Build() - File_multi_package_bar_bar_proto = out.File - file_multi_package_bar_bar_proto_rawDesc = nil - file_multi_package_bar_bar_proto_goTypes = nil - file_multi_package_bar_bar_proto_depIdxs = nil + File_bar_bar_proto = out.File + file_bar_bar_proto_rawDesc = nil + file_bar_bar_proto_goTypes = nil + file_bar_bar_proto_depIdxs = nil } diff --git a/protogen/example/multi-package/bar/bar.proto b/protogen/example/multi-package/bar/bar.proto new file mode 100644 index 00000000..04789417 --- /dev/null +++ b/protogen/example/multi-package/bar/bar.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package bar; + +// this go_package is simulating alias collision +option go_package = "github.com/bavix/gripmock/protogen/example/multi-package/bar"; + +message Bar{ + string name = 1; +} diff --git a/protogen/example/multi-package/foo.pb.go b/protogen/example/multi-package/foo.pb.go index 26a47f01..298a7126 100644 --- a/protogen/example/multi-package/foo.pb.go +++ b/protogen/example/multi-package/foo.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: multi-package/foo.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: foo.proto // simulating neighboring .proto file // but different package @@ -34,7 +34,7 @@ type Response struct { func (x *Response) Reset() { *x = Response{} if protoimpl.UnsafeEnabled { - mi := &file_multi_package_foo_proto_msgTypes[0] + mi := &file_foo_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +47,7 @@ func (x *Response) String() string { func (*Response) ProtoMessage() {} func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_multi_package_foo_proto_msgTypes[0] + mi := &file_foo_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +60,7 @@ func (x *Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Response.ProtoReflect.Descriptor instead. func (*Response) Descriptor() ([]byte, []int) { - return file_multi_package_foo_proto_rawDescGZIP(), []int{0} + return file_foo_proto_rawDescGZIP(), []int{0} } func (x *Response) GetResponse() string { @@ -70,36 +70,36 @@ func (x *Response) GetResponse() string { return "" } -var File_multi_package_foo_proto protoreflect.FileDescriptor - -var file_multi_package_foo_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, - 0x66, 0x6f, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6f, 0x6f, 0x22, 0x26, - 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x79, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2f, - 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_foo_proto protoreflect.FileDescriptor + +var file_foo_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x66, 0x6f, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x6f, 0x6f, + 0x22, 0x26, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, + 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_multi_package_foo_proto_rawDescOnce sync.Once - file_multi_package_foo_proto_rawDescData = file_multi_package_foo_proto_rawDesc + file_foo_proto_rawDescOnce sync.Once + file_foo_proto_rawDescData = file_foo_proto_rawDesc ) -func file_multi_package_foo_proto_rawDescGZIP() []byte { - file_multi_package_foo_proto_rawDescOnce.Do(func() { - file_multi_package_foo_proto_rawDescData = protoimpl.X.CompressGZIP(file_multi_package_foo_proto_rawDescData) +func file_foo_proto_rawDescGZIP() []byte { + file_foo_proto_rawDescOnce.Do(func() { + file_foo_proto_rawDescData = protoimpl.X.CompressGZIP(file_foo_proto_rawDescData) }) - return file_multi_package_foo_proto_rawDescData + return file_foo_proto_rawDescData } -var file_multi_package_foo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_multi_package_foo_proto_goTypes = []interface{}{ +var file_foo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_foo_proto_goTypes = []interface{}{ (*Response)(nil), // 0: foo.Response } -var file_multi_package_foo_proto_depIdxs = []int32{ +var file_foo_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 @@ -107,13 +107,13 @@ var file_multi_package_foo_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_multi_package_foo_proto_init() } -func file_multi_package_foo_proto_init() { - if File_multi_package_foo_proto != nil { +func init() { file_foo_proto_init() } +func file_foo_proto_init() { + if File_foo_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_multi_package_foo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_foo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Response); i { case 0: return &v.state @@ -130,18 +130,18 @@ func file_multi_package_foo_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_multi_package_foo_proto_rawDesc, + RawDescriptor: file_foo_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_multi_package_foo_proto_goTypes, - DependencyIndexes: file_multi_package_foo_proto_depIdxs, - MessageInfos: file_multi_package_foo_proto_msgTypes, + GoTypes: file_foo_proto_goTypes, + DependencyIndexes: file_foo_proto_depIdxs, + MessageInfos: file_foo_proto_msgTypes, }.Build() - File_multi_package_foo_proto = out.File - file_multi_package_foo_proto_rawDesc = nil - file_multi_package_foo_proto_goTypes = nil - file_multi_package_foo_proto_depIdxs = nil + File_foo_proto = out.File + file_foo_proto_rawDesc = nil + file_foo_proto_goTypes = nil + file_foo_proto_depIdxs = nil } diff --git a/protogen/example/multi-package/foo.proto b/protogen/example/multi-package/foo.proto new file mode 100644 index 00000000..64a13914 --- /dev/null +++ b/protogen/example/multi-package/foo.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +// simulating neighboring .proto file +// but different package +package foo; + +// simulating dummy private repo +option go_package = "github.com/bavix/gripmock/protogen/example/multi-package"; + +message Response { + string response = 1; +} diff --git a/protogen/example/multi-package/hello.pb.go b/protogen/example/multi-package/hello.pb.go new file mode 100644 index 00000000..1a9c4d5d --- /dev/null +++ b/protogen/example/multi-package/hello.pb.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: hello.proto + +package multi_package + +import ( + bar "github.com/bavix/gripmock/protogen/example/multi-package/bar" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_hello_proto protoreflect.FileDescriptor + +var file_hello_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x1a, 0x0d, 0x62, 0x61, + 0x72, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x09, 0x66, 0x6f, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x2c, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, + 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x08, 0x2e, 0x62, 0x61, + 0x72, 0x2e, 0x42, 0x61, 0x72, 0x1a, 0x0d, 0x2e, 0x66, 0x6f, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, + 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_hello_proto_goTypes = []interface{}{ + (*bar.Bar)(nil), // 0: bar.Bar + (*Response)(nil), // 1: foo.Response +} +var file_hello_proto_depIdxs = []int32{ + 0, // 0: multi_package.Gripmock.Greet:input_type -> bar.Bar + 1, // 1: multi_package.Gripmock.Greet:output_type -> foo.Response + 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_hello_proto_init() } +func file_hello_proto_init() { + if File_hello_proto != nil { + return + } + file_foo_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_hello_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_hello_proto_goTypes, + DependencyIndexes: file_hello_proto_depIdxs, + }.Build() + File_hello_proto = out.File + file_hello_proto_rawDesc = nil + file_hello_proto_goTypes = nil + file_hello_proto_depIdxs = nil +} diff --git a/protogen/example/multi-package/hello.proto b/protogen/example/multi-package/hello.proto new file mode 100644 index 00000000..4081c0fe --- /dev/null +++ b/protogen/example/multi-package/hello.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +option go_package = "github.com/bavix/gripmock/protogen/example/multi-package"; + +package multi_package; + +import "bar/bar.proto"; +import "foo.proto"; + +// simulate no go_package and folder with - + +service Gripmock { + rpc Greet (bar.Bar) returns (foo.Response); +} + diff --git a/protogen/example/multi-package/hello_grpc.pb.go b/protogen/example/multi-package/hello_grpc.pb.go new file mode 100644 index 00000000..01674993 --- /dev/null +++ b/protogen/example/multi-package/hello_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: hello.proto + +package multi_package + +import ( + context "context" + bar "github.com/bavix/gripmock/protogen/example/multi-package/bar" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Gripmock_Greet_FullMethodName = "/multi_package.Gripmock/Greet" +) + +// GripmockClient is the client API for Gripmock service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GripmockClient interface { + Greet(ctx context.Context, in *bar.Bar, opts ...grpc.CallOption) (*Response, error) +} + +type gripmockClient struct { + cc grpc.ClientConnInterface +} + +func NewGripmockClient(cc grpc.ClientConnInterface) GripmockClient { + return &gripmockClient{cc} +} + +func (c *gripmockClient) Greet(ctx context.Context, in *bar.Bar, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, Gripmock_Greet_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GripmockServer is the server API for Gripmock service. +// All implementations must embed UnimplementedGripmockServer +// for forward compatibility +type GripmockServer interface { + Greet(context.Context, *bar.Bar) (*Response, error) + mustEmbedUnimplementedGripmockServer() +} + +// UnimplementedGripmockServer must be embedded to have forward compatible implementations. +type UnimplementedGripmockServer struct { +} + +func (UnimplementedGripmockServer) Greet(context.Context, *bar.Bar) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented") +} +func (UnimplementedGripmockServer) mustEmbedUnimplementedGripmockServer() {} + +// UnsafeGripmockServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GripmockServer will +// result in compilation errors. +type UnsafeGripmockServer interface { + mustEmbedUnimplementedGripmockServer() +} + +func RegisterGripmockServer(s grpc.ServiceRegistrar, srv GripmockServer) { + s.RegisterService(&Gripmock_ServiceDesc, srv) +} + +func _Gripmock_Greet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(bar.Bar) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GripmockServer).Greet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Gripmock_Greet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GripmockServer).Greet(ctx, req.(*bar.Bar)) + } + return interceptor(ctx, in, info, handler) +} + +// Gripmock_ServiceDesc is the grpc.ServiceDesc for Gripmock service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Gripmock_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "multi_package.Gripmock", + HandlerType: (*GripmockServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Greet", + Handler: _Gripmock_Greet_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "hello.proto", +} diff --git a/protogen/example/one-of/oneof.pb.go b/protogen/example/one-of/oneof.pb.go index 1aa7b4c3..d4f0ee70 100644 --- a/protogen/example/one-of/oneof.pb.go +++ b/protogen/example/one-of/oneof.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: one-of/oneof.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: oneof.proto package one_of @@ -32,7 +32,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_one_of_oneof_proto_msgTypes[0] + mi := &file_oneof_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_one_of_oneof_proto_msgTypes[0] + mi := &file_oneof_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 *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_one_of_oneof_proto_rawDescGZIP(), []int{0} + return file_oneof_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -83,7 +83,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_one_of_oneof_proto_msgTypes[1] + mi := &file_oneof_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96,7 +96,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_one_of_oneof_proto_msgTypes[1] + mi := &file_oneof_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109,7 +109,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_one_of_oneof_proto_rawDescGZIP(), []int{1} + return file_oneof_proto_rawDescGZIP(), []int{1} } func (m *Reply) GetReplyType() isReply_ReplyType { @@ -162,7 +162,7 @@ type Reply1 struct { func (x *Reply1) Reset() { *x = Reply1{} if protoimpl.UnsafeEnabled { - mi := &file_one_of_oneof_proto_msgTypes[2] + mi := &file_oneof_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -175,7 +175,7 @@ func (x *Reply1) String() string { func (*Reply1) ProtoMessage() {} func (x *Reply1) ProtoReflect() protoreflect.Message { - mi := &file_one_of_oneof_proto_msgTypes[2] + mi := &file_oneof_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -188,7 +188,7 @@ func (x *Reply1) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply1.ProtoReflect.Descriptor instead. func (*Reply1) Descriptor() ([]byte, []int) { - return file_one_of_oneof_proto_rawDescGZIP(), []int{2} + return file_oneof_proto_rawDescGZIP(), []int{2} } func (x *Reply1) GetMessage() string { @@ -217,7 +217,7 @@ type Reply2 struct { func (x *Reply2) Reset() { *x = Reply2{} if protoimpl.UnsafeEnabled { - mi := &file_one_of_oneof_proto_msgTypes[3] + mi := &file_oneof_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -230,7 +230,7 @@ func (x *Reply2) String() string { func (*Reply2) ProtoMessage() {} func (x *Reply2) ProtoReflect() protoreflect.Message { - mi := &file_one_of_oneof_proto_msgTypes[3] + mi := &file_oneof_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -243,7 +243,7 @@ func (x *Reply2) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply2.ProtoReflect.Descriptor instead. func (*Reply2) Descriptor() ([]byte, []int) { - return file_one_of_oneof_proto_rawDescGZIP(), []int{3} + return file_oneof_proto_rawDescGZIP(), []int{3} } func (x *Reply2) GetOther() int32 { @@ -253,55 +253,55 @@ func (x *Reply2) GetOther() int32 { return 0 } -var File_one_of_oneof_proto protoreflect.FileDescriptor - -var file_one_of_oneof_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x1d, 0x0a, 0x07, 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, 0x66, 0x0a, 0x05, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x31, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x12, 0x27, 0x0a, 0x06, - 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x48, 0x00, 0x52, 0x06, 0x72, - 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x79, - 0x70, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x1e, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x32, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x32, 0x34, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, - 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, - 0x0e, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0c, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, - 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, - 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +var File_oneof_proto protoreflect.FileDescriptor + +var file_oneof_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x1d, 0x0a, 0x07, 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, 0x66, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, + 0x72, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x31, 0x48, 0x00, 0x52, 0x06, 0x72, + 0x65, 0x70, 0x6c, 0x79, 0x31, 0x12, 0x27, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x32, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x42, 0x0b, + 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x43, 0x0a, 0x06, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x31, 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, 0x12, + 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, + 0x22, 0x1e, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x74, + 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6f, 0x74, 0x68, 0x65, 0x72, + 0x32, 0x34, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x08, + 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0e, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, + 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, + 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x6e, 0x65, 0x2d, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_one_of_oneof_proto_rawDescOnce sync.Once - file_one_of_oneof_proto_rawDescData = file_one_of_oneof_proto_rawDesc + file_oneof_proto_rawDescOnce sync.Once + file_oneof_proto_rawDescData = file_oneof_proto_rawDesc ) -func file_one_of_oneof_proto_rawDescGZIP() []byte { - file_one_of_oneof_proto_rawDescOnce.Do(func() { - file_one_of_oneof_proto_rawDescData = protoimpl.X.CompressGZIP(file_one_of_oneof_proto_rawDescData) +func file_oneof_proto_rawDescGZIP() []byte { + file_oneof_proto_rawDescOnce.Do(func() { + file_oneof_proto_rawDescData = protoimpl.X.CompressGZIP(file_oneof_proto_rawDescData) }) - return file_one_of_oneof_proto_rawDescData + return file_oneof_proto_rawDescData } -var file_one_of_oneof_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_one_of_oneof_proto_goTypes = []interface{}{ +var file_oneof_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_oneof_proto_goTypes = []interface{}{ (*Request)(nil), // 0: oneof.Request (*Reply)(nil), // 1: oneof.Reply (*Reply1)(nil), // 2: oneof.Reply1 (*Reply2)(nil), // 3: oneof.Reply2 } -var file_one_of_oneof_proto_depIdxs = []int32{ +var file_oneof_proto_depIdxs = []int32{ 2, // 0: oneof.Reply.reply1:type_name -> oneof.Reply1 3, // 1: oneof.Reply.reply2:type_name -> oneof.Reply2 0, // 2: oneof.Gripmock.SayHello:input_type -> oneof.Request @@ -313,13 +313,13 @@ var file_one_of_oneof_proto_depIdxs = []int32{ 0, // [0:2] is the sub-list for field type_name } -func init() { file_one_of_oneof_proto_init() } -func file_one_of_oneof_proto_init() { - if File_one_of_oneof_proto != nil { +func init() { file_oneof_proto_init() } +func file_oneof_proto_init() { + if File_oneof_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_one_of_oneof_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_oneof_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -331,7 +331,7 @@ func file_one_of_oneof_proto_init() { return nil } } - file_one_of_oneof_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_oneof_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -343,7 +343,7 @@ func file_one_of_oneof_proto_init() { return nil } } - file_one_of_oneof_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_oneof_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply1); i { case 0: return &v.state @@ -355,7 +355,7 @@ func file_one_of_oneof_proto_init() { return nil } } - file_one_of_oneof_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_oneof_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply2); i { case 0: return &v.state @@ -368,7 +368,7 @@ func file_one_of_oneof_proto_init() { } } } - file_one_of_oneof_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_oneof_proto_msgTypes[1].OneofWrappers = []interface{}{ (*Reply_Reply1)(nil), (*Reply_Reply2)(nil), } @@ -376,18 +376,18 @@ func file_one_of_oneof_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_one_of_oneof_proto_rawDesc, + RawDescriptor: file_oneof_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_one_of_oneof_proto_goTypes, - DependencyIndexes: file_one_of_oneof_proto_depIdxs, - MessageInfos: file_one_of_oneof_proto_msgTypes, + GoTypes: file_oneof_proto_goTypes, + DependencyIndexes: file_oneof_proto_depIdxs, + MessageInfos: file_oneof_proto_msgTypes, }.Build() - File_one_of_oneof_proto = out.File - file_one_of_oneof_proto_rawDesc = nil - file_one_of_oneof_proto_goTypes = nil - file_one_of_oneof_proto_depIdxs = nil + File_oneof_proto = out.File + file_oneof_proto_rawDesc = nil + file_oneof_proto_goTypes = nil + file_oneof_proto_depIdxs = nil } diff --git a/protogen/example/one-of/oneof.proto b/protogen/example/one-of/oneof.proto new file mode 100644 index 00000000..f9888a1d --- /dev/null +++ b/protogen/example/one-of/oneof.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package oneof; + +option go_package = "github.com/bavix/gripmock/protogen/example/one-of"; + +// The Gripmock service definition. +service Gripmock { + // simple unary method + rpc SayHello (Request) returns (Reply); +} + +// The request message containing the user's name. +message Request { + string name = 1; +} + +message Reply { + oneof replyType { + Reply1 reply1 = 1; + Reply2 reply2 = 2; + } +} + +// usual response type +message Reply1 { + string message = 1; + int32 return_code = 2; +} + +// other response type +message Reply2 { + int32 other = 1; +} \ No newline at end of file diff --git a/protogen/example/one-of/oneof_grpc.pb.go b/protogen/example/one-of/oneof_grpc.pb.go index c8dd85b2..093abf6b 100644 --- a/protogen/example/one-of/oneof_grpc.pb.go +++ b/protogen/example/one-of/oneof_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: one-of/oneof.proto +// - protoc v4.24.4 +// source: oneof.proto package one_of @@ -107,5 +107,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "one-of/oneof.proto", + Metadata: "oneof.proto", } diff --git a/protogen/example/simple/simple.pb.go b/protogen/example/simple/simple.pb.go index ab8239c2..83ac2833 100644 --- a/protogen/example/simple/simple.pb.go +++ b/protogen/example/simple/simple.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: simple/simple.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: simple.proto package simple @@ -35,7 +35,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_simple_simple_proto_msgTypes[0] + mi := &file_simple_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -48,7 +48,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_simple_simple_proto_msgTypes[0] + mi := &file_simple_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -61,7 +61,7 @@ func (x *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_simple_simple_proto_rawDescGZIP(), []int{0} + return file_simple_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -107,7 +107,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_simple_simple_proto_msgTypes[1] + mi := &file_simple_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120,7 +120,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_simple_simple_proto_msgTypes[1] + mi := &file_simple_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -133,7 +133,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_simple_simple_proto_rawDescGZIP(), []int{1} + return file_simple_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetMessage() string { @@ -164,52 +164,52 @@ func (x *Reply) GetVuint64() uint64 { return 0 } -var File_simple_simple_proto protoreflect.FileDescriptor +var File_simple_proto protoreflect.FileDescriptor -var file_simple_simple_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0x67, 0x0a, - 0x07, 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, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x74, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x32, 0x36, 0x0a, 0x08, - 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x2a, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0f, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, - 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_simple_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0x67, 0x0a, 0x07, 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, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, + 0x76, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, + 0x74, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x63, 0x6f, 0x64, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x43, + 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x76, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x75, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x32, 0x36, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, + 0x6b, 0x12, 0x2a, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0f, 0x2e, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, + 0x2e, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x33, 0x5a, + 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, + 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_simple_simple_proto_rawDescOnce sync.Once - file_simple_simple_proto_rawDescData = file_simple_simple_proto_rawDesc + file_simple_proto_rawDescOnce sync.Once + file_simple_proto_rawDescData = file_simple_proto_rawDesc ) -func file_simple_simple_proto_rawDescGZIP() []byte { - file_simple_simple_proto_rawDescOnce.Do(func() { - file_simple_simple_proto_rawDescData = protoimpl.X.CompressGZIP(file_simple_simple_proto_rawDescData) +func file_simple_proto_rawDescGZIP() []byte { + file_simple_proto_rawDescOnce.Do(func() { + file_simple_proto_rawDescData = protoimpl.X.CompressGZIP(file_simple_proto_rawDescData) }) - return file_simple_simple_proto_rawDescData + return file_simple_proto_rawDescData } -var file_simple_simple_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_simple_simple_proto_goTypes = []interface{}{ +var file_simple_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_simple_proto_goTypes = []interface{}{ (*Request)(nil), // 0: simple.Request (*Reply)(nil), // 1: simple.Reply } -var file_simple_simple_proto_depIdxs = []int32{ +var file_simple_proto_depIdxs = []int32{ 0, // 0: simple.Gripmock.SayHello:input_type -> simple.Request 1, // 1: simple.Gripmock.SayHello:output_type -> simple.Reply 1, // [1:2] is the sub-list for method output_type @@ -219,13 +219,13 @@ var file_simple_simple_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_simple_simple_proto_init() } -func file_simple_simple_proto_init() { - if File_simple_simple_proto != nil { +func init() { file_simple_proto_init() } +func file_simple_proto_init() { + if File_simple_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_simple_simple_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_simple_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -237,7 +237,7 @@ func file_simple_simple_proto_init() { return nil } } - file_simple_simple_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_simple_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -254,18 +254,18 @@ func file_simple_simple_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_simple_simple_proto_rawDesc, + RawDescriptor: file_simple_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_simple_simple_proto_goTypes, - DependencyIndexes: file_simple_simple_proto_depIdxs, - MessageInfos: file_simple_simple_proto_msgTypes, + GoTypes: file_simple_proto_goTypes, + DependencyIndexes: file_simple_proto_depIdxs, + MessageInfos: file_simple_proto_msgTypes, }.Build() - File_simple_simple_proto = out.File - file_simple_simple_proto_rawDesc = nil - file_simple_simple_proto_goTypes = nil - file_simple_simple_proto_depIdxs = nil + File_simple_proto = out.File + file_simple_proto_rawDesc = nil + file_simple_proto_goTypes = nil + file_simple_proto_depIdxs = nil } diff --git a/protogen/example/simple/simple.proto b/protogen/example/simple/simple.proto new file mode 100644 index 00000000..55661ae4 --- /dev/null +++ b/protogen/example/simple/simple.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package simple; + +option go_package = "github.com/bavix/gripmock/protogen/example/simple"; + +// The Gripmock service definition. +service Gripmock { + // simple unary method + rpc SayHello (Request) returns (Reply); +} + +// The request message containing the user's name. +message Request { + string name = 1; + int64 vint64 = 2; + uint64 vuint64 = 3; + repeated int64 values = 4; +} + +// The response message containing the greetings +message Reply { + string message = 1; + int32 return_code = 2; + int64 vint64 = 3; + uint64 vuint64 = 4; +} \ No newline at end of file diff --git a/protogen/example/simple/simple_grpc.pb.go b/protogen/example/simple/simple_grpc.pb.go index b5cbd24e..7d6d02fb 100644 --- a/protogen/example/simple/simple_grpc.pb.go +++ b/protogen/example/simple/simple_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: simple/simple.proto +// - protoc v4.24.4 +// source: simple.proto package simple @@ -107,5 +107,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "simple/simple.proto", + Metadata: "simple.proto", } diff --git a/protogen/example/stream/stream.pb.go b/protogen/example/stream/stream.pb.go index 961e80ae..b09dc7c7 100644 --- a/protogen/example/stream/stream.pb.go +++ b/protogen/example/stream/stream.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: stream/stream.proto +// protoc-gen-go v1.32.0 +// protoc v4.24.4 +// source: stream.proto package stream @@ -32,7 +32,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_stream_stream_proto_msgTypes[0] + mi := &file_stream_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_stream_stream_proto_msgTypes[0] + mi := &file_stream_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 *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_stream_stream_proto_rawDescGZIP(), []int{0} + return file_stream_proto_rawDescGZIP(), []int{0} } func (x *Request) GetName() string { @@ -80,7 +80,7 @@ type Reply struct { func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { - mi := &file_stream_stream_proto_msgTypes[1] + mi := &file_stream_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93,7 +93,7 @@ func (x *Reply) String() string { func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { - mi := &file_stream_stream_proto_msgTypes[1] + mi := &file_stream_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106,7 +106,7 @@ func (x *Reply) ProtoReflect() protoreflect.Message { // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { - return file_stream_stream_proto_rawDescGZIP(), []int{1} + return file_stream_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetMessage() string { @@ -116,49 +116,49 @@ func (x *Reply) GetMessage() string { return "" } -var File_stream_stream_proto protoreflect.FileDescriptor - -var file_stream_stream_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x1d, 0x0a, - 0x07, 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, 0x21, 0x0a, 0x05, - 0x52, 0x65, 0x70, 0x6c, 0x79, 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, - 0xa3, 0x01, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x30, 0x0a, 0x0c, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x30, - 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, - 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, - 0x12, 0x33, 0x0a, 0x0d, 0x62, 0x69, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, - 0x63, 0x6b, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_stream_proto protoreflect.FileDescriptor + +var file_stream_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x1d, 0x0a, 0x07, 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, 0x21, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 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, 0xa3, 0x01, 0x0a, 0x08, 0x47, 0x72, 0x69, + 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, 0x30, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x30, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x12, 0x33, 0x0a, 0x0d, 0x62, 0x69, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x0f, 0x2e, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x30, 0x01, 0x42, 0x33, + 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, + 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_stream_stream_proto_rawDescOnce sync.Once - file_stream_stream_proto_rawDescData = file_stream_stream_proto_rawDesc + file_stream_proto_rawDescOnce sync.Once + file_stream_proto_rawDescData = file_stream_proto_rawDesc ) -func file_stream_stream_proto_rawDescGZIP() []byte { - file_stream_stream_proto_rawDescOnce.Do(func() { - file_stream_stream_proto_rawDescData = protoimpl.X.CompressGZIP(file_stream_stream_proto_rawDescData) +func file_stream_proto_rawDescGZIP() []byte { + file_stream_proto_rawDescOnce.Do(func() { + file_stream_proto_rawDescData = protoimpl.X.CompressGZIP(file_stream_proto_rawDescData) }) - return file_stream_stream_proto_rawDescData + return file_stream_proto_rawDescData } -var file_stream_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_stream_stream_proto_goTypes = []interface{}{ +var file_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_stream_proto_goTypes = []interface{}{ (*Request)(nil), // 0: stream.Request (*Reply)(nil), // 1: stream.Reply } -var file_stream_stream_proto_depIdxs = []int32{ +var file_stream_proto_depIdxs = []int32{ 0, // 0: stream.Gripmock.serverStream:input_type -> stream.Request 0, // 1: stream.Gripmock.clientStream:input_type -> stream.Request 0, // 2: stream.Gripmock.bidirectional:input_type -> stream.Request @@ -172,13 +172,13 @@ var file_stream_stream_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_stream_stream_proto_init() } -func file_stream_stream_proto_init() { - if File_stream_stream_proto != nil { +func init() { file_stream_proto_init() } +func file_stream_proto_init() { + if File_stream_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_stream_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -190,7 +190,7 @@ func file_stream_stream_proto_init() { return nil } } - file_stream_stream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_stream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state @@ -207,18 +207,18 @@ func file_stream_stream_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_stream_stream_proto_rawDesc, + RawDescriptor: file_stream_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_stream_stream_proto_goTypes, - DependencyIndexes: file_stream_stream_proto_depIdxs, - MessageInfos: file_stream_stream_proto_msgTypes, + GoTypes: file_stream_proto_goTypes, + DependencyIndexes: file_stream_proto_depIdxs, + MessageInfos: file_stream_proto_msgTypes, }.Build() - File_stream_stream_proto = out.File - file_stream_stream_proto_rawDesc = nil - file_stream_stream_proto_goTypes = nil - file_stream_stream_proto_depIdxs = nil + File_stream_proto = out.File + file_stream_proto_rawDesc = nil + file_stream_proto_goTypes = nil + file_stream_proto_depIdxs = nil } diff --git a/protogen/example/stream/stream.proto b/protogen/example/stream/stream.proto new file mode 100644 index 00000000..84b38305 --- /dev/null +++ b/protogen/example/stream/stream.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package stream; + +option go_package = "github.com/bavix/gripmock/protogen/example/stream"; +// The Gripmock service definition. +service Gripmock { + // server to client sreaming + rpc serverStream (Request) returns (stream Reply); + // client to server streaming + rpc clientStream (stream Request) returns (Reply); + // bidirectional streaming + rpc bidirectional (stream Request) returns (stream Reply); +} + +// The request message containing the user's name. +message Request { + string name = 1; +} + +// The response message containing the greetings +message Reply { + string message = 1; +} \ No newline at end of file diff --git a/protogen/example/stream/stream_grpc.pb.go b/protogen/example/stream/stream_grpc.pb.go index 71387f94..7afb25ce 100644 --- a/protogen/example/stream/stream_grpc.pb.go +++ b/protogen/example/stream/stream_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: stream/stream.proto +// - protoc v4.24.4 +// source: stream.proto package stream @@ -278,5 +278,5 @@ var Gripmock_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "stream/stream.proto", + Metadata: "stream.proto", } diff --git a/protogen/example/stub-subfolders/stub-subfolders.pb.go b/protogen/example/stub-subfolders/stub-subfolders.pb.go index fc51ca8e..11150138 100644 --- a/protogen/example/stub-subfolders/stub-subfolders.pb.go +++ b/protogen/example/stub-subfolders/stub-subfolders.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.32.0 +// protoc v4.24.4 // source: stub-subfolders.proto package stub_subfolders @@ -140,11 +140,11 @@ var file_stub_subfolders_proto_rawDesc = []byte{ 0x6c, 0x6c, 0x6f, 0x12, 0x18, 0x2e, 0x73, 0x74, 0x75, 0x62, 0x5f, 0x73, 0x75, 0x62, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x73, 0x74, 0x75, 0x62, 0x5f, 0x73, 0x75, 0x62, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x2e, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, 0x69, 0x61, 0x2f, 0x67, 0x72, - 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x75, 0x62, 0x2d, 0x73, 0x75, 0x62, - 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, + 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x75, 0x62, 0x2d, 0x73, 0x75, 0x62, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protogen/example/stub-subfolders/stub-subfolders.proto b/protogen/example/stub-subfolders/stub-subfolders.proto new file mode 100644 index 00000000..50df5acc --- /dev/null +++ b/protogen/example/stub-subfolders/stub-subfolders.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +option go_package = "github.com/bavix/gripmock/protogen/example/stub-subfolders"; + +package stub_subfolders; + +// The Gripmock service definition. +service Gripmock { + // simple unary method + rpc SayHello (Request) returns (Reply); +} + +// The request message containing the user's name. +message Request { + string name = 1; +} + +// The response message containing the greetings +message Reply { + string message = 1; + int32 return_code = 2; +} \ No newline at end of file diff --git a/protogen/example/stub-subfolders/stub-subfolders_grpc.pb.go b/protogen/example/stub-subfolders/stub-subfolders_grpc.pb.go index 5050a49f..b436ce3d 100644 --- a/protogen/example/stub-subfolders/stub-subfolders_grpc.pb.go +++ b/protogen/example/stub-subfolders/stub-subfolders_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.4 // source: stub-subfolders.proto package stub_subfolders diff --git a/protogen/example/well_known_types/wkt.pb.go b/protogen/example/well_known_types/wkt.pb.go index 14f64d48..e3e9d428 100644 --- a/protogen/example/well_known_types/wkt.pb.go +++ b/protogen/example/well_known_types/wkt.pb.go @@ -1,12 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.32.0 +// protoc v4.24.4 // source: wkt.proto package well_known_types import ( + _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" apipb "google.golang.org/protobuf/types/known/apipb" @@ -25,20 +26,24 @@ var File_wkt_proto protoreflect.FileDescriptor var file_wkt_proto_rawDesc = []byte{ 0x0a, 0x09, 0x77, 0x6b, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x77, 0x65, 0x6c, - 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 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, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x43, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, - 0x6b, 0x12, 0x37, 0x0a, 0x07, 0x41, 0x70, 0x69, 0x49, 0x6e, 0x66, 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, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x70, 0x69, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6b, 0x6f, 0x70, 0x65, 0x64, - 0x69, 0x61, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x77, 0x65, 0x6c, - 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x1c, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 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, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x32, 0x65, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x12, + 0x59, 0x0a, 0x07, 0x41, 0x70, 0x69, 0x49, 0x6e, 0x66, 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, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x70, 0x69, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, + 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, + 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x76, 0x69, 0x78, 0x2f, 0x67, + 0x72, 0x69, 0x70, 0x6d, 0x6f, 0x63, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, + 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var file_wkt_proto_goTypes = []interface{}{ diff --git a/protogen/example/well_known_types/wkt.proto b/protogen/example/well_known_types/wkt.proto new file mode 100644 index 00000000..647f296a --- /dev/null +++ b/protogen/example/well_known_types/wkt.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package well_known_types; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/api.proto"; + +option go_package = "github.com/bavix/gripmock/protogen/example/well_known_types"; +service Gripmock { + // this shows us example on using WKT as dependency + // api.proto in particular has go_package alias with semicolon + // "google.golang.org/genproto/protobuf/api;api" + rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api) { + option (google.api.http) = { + post: "/v1/gripmock/api-info" + body: "*" + }; + } +} diff --git a/protogen/example/well_known_types/wkt_grpc.pb.go b/protogen/example/well_known_types/wkt_grpc.pb.go index 27f11543..753de317 100644 --- a/protogen/example/well_known_types/wkt_grpc.pb.go +++ b/protogen/example/well_known_types/wkt_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.4 // source: wkt.proto package well_known_types