From dacda653e05adce138e18e01b9b0561719bfbb83 Mon Sep 17 00:00:00 2001 From: kruskal <99559985+kruskall@users.noreply.github.com> Date: Fri, 1 Sep 2023 01:24:18 +0200 Subject: [PATCH] test: improve tools to generate testservice pb message --- Makefile | 4 + internal/apmgodog/go.mod | 5 +- internal/apmgodog/go.sum | 10 +- module/apmgokit/go.mod | 5 +- module/apmgokit/go.sum | 11 +- module/apmgrpc/go.mod | 5 +- module/apmgrpc/go.sum | 11 +- .../apmgrpc/internal/testservice/generate.go | 20 - .../internal/testservice/testservice.pb.go | 353 +++++++++--------- .../internal/testservice/testservice.proto | 2 +- .../testservice/testservice_grpc.pb.go | 158 ++++++++ scripts/generate-testservice.sh | 11 + scripts/install-protobuf.sh | 37 ++ 13 files changed, 413 insertions(+), 219 deletions(-) delete mode 100644 module/apmgrpc/internal/testservice/generate.go create mode 100644 module/apmgrpc/internal/testservice/testservice_grpc.pb.go create mode 100755 scripts/generate-testservice.sh create mode 100755 scripts/install-protobuf.sh diff --git a/Makefile b/Makefile index 501cd0d84..caba0a149 100644 --- a/Makefile +++ b/Makefile @@ -72,5 +72,9 @@ update-licenses: model/marshal_fastjson.go: model/model.go go generate ./model +module/apmgrpc/internal/testservice/testservice.pb.go: + ./scripts/install-protobuf.sh + ./scripts/generate-testservice.sh + scripts/Dockerfile-testing: $(wildcard module/*) go generate ./scripts diff --git a/internal/apmgodog/go.mod b/internal/apmgodog/go.mod index 1bf2a7c19..79c3fd5ca 100644 --- a/internal/apmgodog/go.mod +++ b/internal/apmgodog/go.mod @@ -19,8 +19,8 @@ require ( github.com/elastic/go-sysinfo v1.7.1 // indirect github.com/elastic/go-windows v1.0.0 // indirect github.com/gofrs/uuid v4.0.0+incompatible // indirect - github.com/golang/protobuf v1.3.2 // indirect - github.com/google/go-cmp v0.5.4 // indirect + github.com/golang/protobuf v1.5.0 // indirect + github.com/google/go-cmp v0.5.5 // indirect github.com/hashicorp/go-immutable-radix v1.3.0 // indirect github.com/hashicorp/go-memdb v1.3.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect @@ -34,6 +34,7 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect ) diff --git a/internal/apmgodog/go.sum b/internal/apmgodog/go.sum index a3873f03c..f4e8afac8 100644 --- a/internal/apmgodog/go.sum +++ b/internal/apmgodog/go.sum @@ -69,14 +69,15 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -335,6 +336,9 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/module/apmgokit/go.mod b/module/apmgokit/go.mod index 5fe508276..67fc95025 100644 --- a/module/apmgokit/go.mod +++ b/module/apmgokit/go.mod @@ -17,8 +17,8 @@ require ( github.com/elastic/go-windows v1.0.0 // indirect github.com/go-logfmt/logfmt v0.4.0 // indirect github.com/go-stack/stack v1.8.0 // indirect - github.com/golang/protobuf v1.2.0 // indirect - github.com/google/go-cmp v0.5.4 // indirect + github.com/golang/protobuf v1.5.0 // indirect + github.com/google/go-cmp v0.5.5 // indirect github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -29,6 +29,7 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect ) diff --git a/module/apmgokit/go.sum b/module/apmgokit/go.sum index 3eb8cc312..2c089f768 100644 --- a/module/apmgokit/go.sum +++ b/module/apmgokit/go.sum @@ -18,10 +18,11 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -64,7 +65,6 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -87,6 +87,9 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/module/apmgrpc/go.mod b/module/apmgrpc/go.mod index f50ebe625..d24064a6b 100644 --- a/module/apmgrpc/go.mod +++ b/module/apmgrpc/go.mod @@ -1,12 +1,12 @@ module go.elastic.co/apm/module/apmgrpc/v2 require ( - github.com/golang/protobuf v1.2.0 github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 github.com/stretchr/testify v1.8.4 go.elastic.co/apm/module/apmhttp/v2 v2.4.4 go.elastic.co/apm/v2 v2.4.4 google.golang.org/grpc v1.17.0 + google.golang.org/protobuf v1.31.0 ) require ( @@ -14,7 +14,8 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/elastic/go-sysinfo v1.7.1 // indirect github.com/elastic/go-windows v1.0.0 // indirect - github.com/google/go-cmp v0.5.4 // indirect + github.com/golang/protobuf v1.5.0 // indirect + github.com/google/go-cmp v0.5.5 // indirect github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/module/apmgrpc/go.sum b/module/apmgrpc/go.sum index 730b1b19d..7b72d01f2 100644 --- a/module/apmgrpc/go.sum +++ b/module/apmgrpc/go.sum @@ -12,10 +12,11 @@ github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -56,7 +57,6 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -79,6 +79,9 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/module/apmgrpc/internal/testservice/generate.go b/module/apmgrpc/internal/testservice/generate.go deleted file mode 100644 index ae1809db5..000000000 --- a/module/apmgrpc/internal/testservice/generate.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -//go:generate protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative testservice.proto - -package testservice diff --git a/module/apmgrpc/internal/testservice/testservice.pb.go b/module/apmgrpc/internal/testservice/testservice.pb.go index 06e07129e..92dc665d4 100644 --- a/module/apmgrpc/internal/testservice/testservice.pb.go +++ b/module/apmgrpc/internal/testservice/testservice.pb.go @@ -16,233 +16,224 @@ // under the License. // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.24.2 // source: testservice.proto -package testservice // import "go.elastic.co/apm/module/apmgrpc/internal/testservice" +package testservice import ( - fmt "fmt" - - proto "github.com/golang/protobuf/proto" - - math "math" - - context "context" - - grpc "google.golang.org/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +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 AccumulateRequest struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *AccumulateRequest) Reset() { *m = AccumulateRequest{} } -func (m *AccumulateRequest) String() string { return proto.CompactTextString(m) } -func (*AccumulateRequest) ProtoMessage() {} -func (*AccumulateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_testservice_6101db31074a6f55, []int{0} -} -func (m *AccumulateRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AccumulateRequest.Unmarshal(m, b) -} -func (m *AccumulateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AccumulateRequest.Marshal(b, m, deterministic) -} -func (dst *AccumulateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccumulateRequest.Merge(dst, src) + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` } -func (m *AccumulateRequest) XXX_Size() int { - return xxx_messageInfo_AccumulateRequest.Size(m) -} -func (m *AccumulateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AccumulateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AccumulateRequest proto.InternalMessageInfo -func (m *AccumulateRequest) GetValue() int64 { - if m != nil { - return m.Value +func (x *AccumulateRequest) Reset() { + *x = AccumulateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testservice_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -type AccumulateReply struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *AccumulateRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AccumulateReply) Reset() { *m = AccumulateReply{} } -func (m *AccumulateReply) String() string { return proto.CompactTextString(m) } -func (*AccumulateReply) ProtoMessage() {} -func (*AccumulateReply) Descriptor() ([]byte, []int) { - return fileDescriptor_testservice_6101db31074a6f55, []int{1} -} -func (m *AccumulateReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AccumulateReply.Unmarshal(m, b) -} -func (m *AccumulateReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AccumulateReply.Marshal(b, m, deterministic) -} -func (dst *AccumulateReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccumulateReply.Merge(dst, src) -} -func (m *AccumulateReply) XXX_Size() int { - return xxx_messageInfo_AccumulateReply.Size(m) -} -func (m *AccumulateReply) XXX_DiscardUnknown() { - xxx_messageInfo_AccumulateReply.DiscardUnknown(m) -} - -var xxx_messageInfo_AccumulateReply proto.InternalMessageInfo +func (*AccumulateRequest) ProtoMessage() {} -func (m *AccumulateReply) GetValue() int64 { - if m != nil { - return m.Value +func (x *AccumulateRequest) ProtoReflect() protoreflect.Message { + mi := &file_testservice_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 0 + return mi.MessageOf(x) } -func init() { - proto.RegisterType((*AccumulateRequest)(nil), "go.elastic.co.apm.module.apmgrpc.testservice.AccumulateRequest") - proto.RegisterType((*AccumulateReply)(nil), "go.elastic.co.apm.module.apmgrpc.testservice.AccumulateReply") +// Deprecated: Use AccumulateRequest.ProtoReflect.Descriptor instead. +func (*AccumulateRequest) Descriptor() ([]byte, []int) { + return file_testservice_proto_rawDescGZIP(), []int{0} } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// AccumulatorClient is the client API for Accumulator service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AccumulatorClient interface { - Accumulate(ctx context.Context, opts ...grpc.CallOption) (Accumulator_AccumulateClient, error) +func (x *AccumulateRequest) GetValue() int64 { + if x != nil { + return x.Value + } + return 0 } -type accumulatorClient struct { - cc *grpc.ClientConn -} +type AccumulateReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func NewAccumulatorClient(cc *grpc.ClientConn) AccumulatorClient { - return &accumulatorClient{cc} + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` } -func (c *accumulatorClient) Accumulate(ctx context.Context, opts ...grpc.CallOption) (Accumulator_AccumulateClient, error) { - stream, err := c.cc.NewStream(ctx, &_Accumulator_serviceDesc.Streams[0], "/go.elastic.co.apm.module.apmgrpc.testservice.Accumulator/Accumulate", opts...) - if err != nil { - return nil, err +func (x *AccumulateReply) Reset() { + *x = AccumulateReply{} + if protoimpl.UnsafeEnabled { + mi := &file_testservice_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - x := &accumulatorAccumulateClient{stream} - return x, nil } -type Accumulator_AccumulateClient interface { - Send(*AccumulateRequest) error - Recv() (*AccumulateReply, error) - grpc.ClientStream +func (x *AccumulateReply) String() string { + return protoimpl.X.MessageStringOf(x) } -type accumulatorAccumulateClient struct { - grpc.ClientStream -} - -func (x *accumulatorAccumulateClient) Send(m *AccumulateRequest) error { - return x.ClientStream.SendMsg(m) -} +func (*AccumulateReply) ProtoMessage() {} -func (x *accumulatorAccumulateClient) Recv() (*AccumulateReply, error) { - m := new(AccumulateReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err +func (x *AccumulateReply) ProtoReflect() protoreflect.Message { + mi := &file_testservice_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 m, nil + return mi.MessageOf(x) } -// AccumulatorServer is the server API for Accumulator service. -type AccumulatorServer interface { - Accumulate(Accumulator_AccumulateServer) error +// Deprecated: Use AccumulateReply.ProtoReflect.Descriptor instead. +func (*AccumulateReply) Descriptor() ([]byte, []int) { + return file_testservice_proto_rawDescGZIP(), []int{1} } -func RegisterAccumulatorServer(s *grpc.Server, srv AccumulatorServer) { - s.RegisterService(&_Accumulator_serviceDesc, srv) +func (x *AccumulateReply) GetValue() int64 { + if x != nil { + return x.Value + } + return 0 } -func _Accumulator_Accumulate_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccumulatorServer).Accumulate(&accumulatorAccumulateServer{stream}) -} +var File_testservice_proto protoreflect.FileDescriptor + +var file_testservice_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x2c, 0x67, 0x6f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, + 0x63, 0x6f, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x61, 0x70, + 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x22, 0x29, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x27, 0x0a, 0x0f, + 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0xa2, 0x01, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, + 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x92, 0x01, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, + 0x6c, 0x61, 0x74, 0x65, 0x12, 0x3f, 0x2e, 0x67, 0x6f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, + 0x63, 0x2e, 0x63, 0x6f, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, + 0x61, 0x70, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x67, 0x6f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, + 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x61, 0x70, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x6f, + 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x2f, 0x61, 0x70, 0x6d, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, + 0x32, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_testservice_proto_rawDescOnce sync.Once + file_testservice_proto_rawDescData = file_testservice_proto_rawDesc +) -type Accumulator_AccumulateServer interface { - Send(*AccumulateReply) error - Recv() (*AccumulateRequest, error) - grpc.ServerStream +func file_testservice_proto_rawDescGZIP() []byte { + file_testservice_proto_rawDescOnce.Do(func() { + file_testservice_proto_rawDescData = protoimpl.X.CompressGZIP(file_testservice_proto_rawDescData) + }) + return file_testservice_proto_rawDescData } -type accumulatorAccumulateServer struct { - grpc.ServerStream +var file_testservice_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_testservice_proto_goTypes = []interface{}{ + (*AccumulateRequest)(nil), // 0: go.elastic.co.apm.module.apmgrpc.testservice.AccumulateRequest + (*AccumulateReply)(nil), // 1: go.elastic.co.apm.module.apmgrpc.testservice.AccumulateReply } - -func (x *accumulatorAccumulateServer) Send(m *AccumulateReply) error { - return x.ServerStream.SendMsg(m) +var file_testservice_proto_depIdxs = []int32{ + 0, // 0: go.elastic.co.apm.module.apmgrpc.testservice.Accumulator.Accumulate:input_type -> go.elastic.co.apm.module.apmgrpc.testservice.AccumulateRequest + 1, // 1: go.elastic.co.apm.module.apmgrpc.testservice.Accumulator.Accumulate:output_type -> go.elastic.co.apm.module.apmgrpc.testservice.AccumulateReply + 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 (x *accumulatorAccumulateServer) Recv() (*AccumulateRequest, error) { - m := new(AccumulateRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err +func init() { file_testservice_proto_init() } +func file_testservice_proto_init() { + if File_testservice_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_testservice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccumulateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testservice_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccumulateReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return m, nil -} - -var _Accumulator_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.elastic.co.apm.module.apmgrpc.testservice.Accumulator", - HandlerType: (*AccumulatorServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Accumulate", - Handler: _Accumulator_Accumulate_Handler, - ServerStreams: true, - ClientStreams: true, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_testservice_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, }, - }, - Metadata: "testservice.proto", -} - -func init() { proto.RegisterFile("testservice.proto", fileDescriptor_testservice_6101db31074a6f55) } - -var fileDescriptor_testservice_6101db31074a6f55 = []byte{ - // 201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x49, 0x2d, 0x2e, - 0x29, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x49, - 0xcf, 0xd7, 0x4b, 0xcd, 0x49, 0x2c, 0x2e, 0xc9, 0x4c, 0xd6, 0x4b, 0xce, 0xd7, 0x4b, 0x2c, 0xc8, - 0xd5, 0xcb, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x05, 0x31, 0xd3, 0x8b, 0x0a, 0x92, 0xf5, 0x90, 0xf4, - 0x28, 0x69, 0x72, 0x09, 0x3a, 0x26, 0x27, 0x97, 0xe6, 0x96, 0xe6, 0x24, 0x96, 0xa4, 0x06, 0xa5, - 0x16, 0x96, 0xa6, 0x16, 0x97, 0x08, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0xa6, 0x4a, 0x30, - 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x41, 0x38, 0x4a, 0xea, 0x5c, 0xfc, 0xc8, 0x4a, 0x0b, 0x72, 0x2a, - 0xb1, 0x2b, 0x34, 0x5a, 0xc4, 0xc8, 0xc5, 0x0d, 0x57, 0x99, 0x5f, 0x24, 0x34, 0x89, 0x91, 0x8b, - 0x0b, 0xa1, 0x53, 0xc8, 0x5e, 0x8f, 0x14, 0x17, 0xea, 0x61, 0x38, 0x4f, 0xca, 0x96, 0x7c, 0x03, - 0x0a, 0x72, 0x2a, 0x95, 0x18, 0x34, 0x18, 0x0d, 0x18, 0x9d, 0xcc, 0xa3, 0x4c, 0x51, 0x4c, 0xd1, - 0x4f, 0x2c, 0xc8, 0xd5, 0x87, 0x98, 0xa2, 0x0f, 0x35, 0x45, 0x3f, 0x33, 0xaf, 0x24, 0xb5, 0x28, - 0x2f, 0x31, 0x47, 0x1f, 0xc9, 0xb8, 0x24, 0x36, 0x70, 0x30, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xb0, 0xb9, 0xd9, 0xf0, 0x7b, 0x01, 0x00, 0x00, + GoTypes: file_testservice_proto_goTypes, + DependencyIndexes: file_testservice_proto_depIdxs, + MessageInfos: file_testservice_proto_msgTypes, + }.Build() + File_testservice_proto = out.File + file_testservice_proto_rawDesc = nil + file_testservice_proto_goTypes = nil + file_testservice_proto_depIdxs = nil } diff --git a/module/apmgrpc/internal/testservice/testservice.proto b/module/apmgrpc/internal/testservice/testservice.proto index 27b1503b7..bbccdf887 100644 --- a/module/apmgrpc/internal/testservice/testservice.proto +++ b/module/apmgrpc/internal/testservice/testservice.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package go.elastic.co.apm.module.apmgrpc.testservice; -option go_package = "go.elastic.co/apm/module/apmgrpc/internal/testservice"; +option go_package = "go.elastic.co/apm/module/apmgrpc/v2/internal/testservice"; service Accumulator { rpc Accumulate(stream AccumulateRequest) returns (stream AccumulateReply) {} diff --git a/module/apmgrpc/internal/testservice/testservice_grpc.pb.go b/module/apmgrpc/internal/testservice/testservice_grpc.pb.go new file mode 100644 index 000000000..e24718a0e --- /dev/null +++ b/module/apmgrpc/internal/testservice/testservice_grpc.pb.go @@ -0,0 +1,158 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.2 +// source: testservice.proto + +package testservice + +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 ( + Accumulator_Accumulate_FullMethodName = "/go.elastic.co.apm.module.apmgrpc.testservice.Accumulator/Accumulate" +) + +// AccumulatorClient is the client API for Accumulator 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 AccumulatorClient interface { + Accumulate(ctx context.Context, opts ...grpc.CallOption) (Accumulator_AccumulateClient, error) +} + +type accumulatorClient struct { + cc grpc.ClientConnInterface +} + +func NewAccumulatorClient(cc grpc.ClientConnInterface) AccumulatorClient { + return &accumulatorClient{cc} +} + +func (c *accumulatorClient) Accumulate(ctx context.Context, opts ...grpc.CallOption) (Accumulator_AccumulateClient, error) { + stream, err := c.cc.NewStream(ctx, &Accumulator_ServiceDesc.Streams[0], Accumulator_Accumulate_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &accumulatorAccumulateClient{stream} + return x, nil +} + +type Accumulator_AccumulateClient interface { + Send(*AccumulateRequest) error + Recv() (*AccumulateReply, error) + grpc.ClientStream +} + +type accumulatorAccumulateClient struct { + grpc.ClientStream +} + +func (x *accumulatorAccumulateClient) Send(m *AccumulateRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *accumulatorAccumulateClient) Recv() (*AccumulateReply, error) { + m := new(AccumulateReply) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// AccumulatorServer is the server API for Accumulator service. +// All implementations must embed UnimplementedAccumulatorServer +// for forward compatibility +type AccumulatorServer interface { + Accumulate(Accumulator_AccumulateServer) error + mustEmbedUnimplementedAccumulatorServer() +} + +// UnimplementedAccumulatorServer must be embedded to have forward compatible implementations. +type UnimplementedAccumulatorServer struct { +} + +func (UnimplementedAccumulatorServer) Accumulate(Accumulator_AccumulateServer) error { + return status.Errorf(codes.Unimplemented, "method Accumulate not implemented") +} +func (UnimplementedAccumulatorServer) mustEmbedUnimplementedAccumulatorServer() {} + +// UnsafeAccumulatorServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AccumulatorServer will +// result in compilation errors. +type UnsafeAccumulatorServer interface { + mustEmbedUnimplementedAccumulatorServer() +} + +func RegisterAccumulatorServer(s grpc.ServiceRegistrar, srv AccumulatorServer) { + s.RegisterService(&Accumulator_ServiceDesc, srv) +} + +func _Accumulator_Accumulate_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AccumulatorServer).Accumulate(&accumulatorAccumulateServer{stream}) +} + +type Accumulator_AccumulateServer interface { + Send(*AccumulateReply) error + Recv() (*AccumulateRequest, error) + grpc.ServerStream +} + +type accumulatorAccumulateServer struct { + grpc.ServerStream +} + +func (x *accumulatorAccumulateServer) Send(m *AccumulateReply) error { + return x.ServerStream.SendMsg(m) +} + +func (x *accumulatorAccumulateServer) Recv() (*AccumulateRequest, error) { + m := new(AccumulateRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Accumulator_ServiceDesc is the grpc.ServiceDesc for Accumulator service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Accumulator_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "go.elastic.co.apm.module.apmgrpc.testservice.Accumulator", + HandlerType: (*AccumulatorServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Accumulate", + Handler: _Accumulator_Accumulate_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "testservice.proto", +} diff --git a/scripts/generate-testservice.sh b/scripts/generate-testservice.sh new file mode 100755 index 000000000..b7a4a17a3 --- /dev/null +++ b/scripts/generate-testservice.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +TOOLS_DIR=$(dirname "$(readlink -f -- "$0")") + +PATH="${TOOLS_DIR}/build/bin:${PATH}" protoc \ + --proto_path=./module/apmgrpc/internal/testservice/ \ + --go_out=./module/apmgrpc \ + --go-grpc_out=./module/apmgrpc \ + --go_opt=module=go.elastic.co/apm/module/apmgrpc/v2 \ + --go-grpc_opt=module=go.elastic.co/apm/module/apmgrpc/v2 \ + ./module/apmgrpc/internal/testservice/testservice.proto diff --git a/scripts/install-protobuf.sh b/scripts/install-protobuf.sh new file mode 100755 index 000000000..7e728d0c4 --- /dev/null +++ b/scripts/install-protobuf.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +PLATFORM=$(go env GOOS) +PROTOBUF_VERSION="24.2" +PROTOC_GO_VERSION="v1.31.0" +PROTOC_GO_GRPC_VERSION="v1.3.0" + + +if [ "${PLATFORM}" = "darwin" ]; then + PROTOBUF_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-osx-x86_64.zip" +elif [ "${PLATFORM}" = "linux" ]; then + PROTOBUF_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" +elif [ "${PLATFORM}" = "windows" ]; then + PROTOBUF_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-win64.zip" +else + echo "Unsupported platform: ${PLATFORM}" + exit 1 +fi + +TOOLS_DIR=$(dirname "$(readlink -f -- "$0")") +BUILD_DIR="${TOOLS_DIR}/build" +PROTOBUF_ZIP="/tmp/protobuf.zip" + +curl -L "${PROTOBUF_URL}" -o "${PROTOBUF_ZIP}" + +if ! unzip -o "${PROTOBUF_ZIP}" -d "${BUILD_DIR}"; then + echo "failed to extract protobuf" + exit 1 +fi + +if ! PATH="${BUILD_DIR}/bin" protoc --version; then + echo "failed to verify protobuf installation" + exit 1 +fi + +GOBIN="${BUILD_DIR}/bin" go install "google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GO_VERSION}" +GOBIN="${BUILD_DIR}/bin" go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GO_GRPC_VERSION}"