From e75a0d5bfec510517ddee94a655d0a0da63b7bea Mon Sep 17 00:00:00 2001 From: yinheli Date: Mon, 6 Sep 2021 10:54:17 +0800 Subject: [PATCH] chore: update grpc-service example --- example/grpc-service/buf/v1/calculator.pb.go | 5 ++--- example/grpc-service/buf/v1/calculator.pb.gw.go | 4 ++-- example/grpc-service/buf/v1/calculator_grpc.pb.go | 1 - example/grpc-service/buf/v1/hello.pb.go | 5 ++--- example/grpc-service/buf/v1/hello.pb.gw.go | 4 ++-- example/grpc-service/buf/v1/hello_grpc.pb.go | 1 - example/grpc-service/go.mod | 12 ++++++------ example/rest-service/go.mod | 4 ++-- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/example/grpc-service/buf/v1/calculator.pb.go b/example/grpc-service/buf/v1/calculator.pb.go index adc3e5e..8733ba8 100644 --- a/example/grpc-service/buf/v1/calculator.pb.go +++ b/example/grpc-service/buf/v1/calculator.pb.go @@ -7,9 +7,6 @@ package v1 import ( - reflect "reflect" - sync "sync" - _ "github.com/envoyproxy/protoc-gen-validate/validate" _ "google.golang.org/genproto/googleapis/api/annotations" _ "google.golang.org/genproto/googleapis/api/httpbody" @@ -18,6 +15,8 @@ import ( _ "google.golang.org/protobuf/types/known/anypb" _ "google.golang.org/protobuf/types/known/emptypb" _ "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" ) const ( diff --git a/example/grpc-service/buf/v1/calculator.pb.gw.go b/example/grpc-service/buf/v1/calculator.pb.gw.go index 6092673..0a3888f 100644 --- a/example/grpc-service/buf/v1/calculator.pb.gw.go +++ b/example/grpc-service/buf/v1/calculator.pb.gw.go @@ -77,7 +77,7 @@ func RegisterCalculatorServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/buf.v1.CalculatorService/AddInt") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/buf.v1.CalculatorService/AddInt", runtime.WithHTTPPathPattern("/rpc/v1/calculator")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -139,7 +139,7 @@ func RegisterCalculatorServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/buf.v1.CalculatorService/AddInt") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/buf.v1.CalculatorService/AddInt", runtime.WithHTTPPathPattern("/rpc/v1/calculator")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/example/grpc-service/buf/v1/calculator_grpc.pb.go b/example/grpc-service/buf/v1/calculator_grpc.pb.go index 1e4f15e..19ef99f 100644 --- a/example/grpc-service/buf/v1/calculator_grpc.pb.go +++ b/example/grpc-service/buf/v1/calculator_grpc.pb.go @@ -4,7 +4,6 @@ package v1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/example/grpc-service/buf/v1/hello.pb.go b/example/grpc-service/buf/v1/hello.pb.go index f478c43..374c8ee 100644 --- a/example/grpc-service/buf/v1/hello.pb.go +++ b/example/grpc-service/buf/v1/hello.pb.go @@ -7,9 +7,6 @@ package v1 import ( - reflect "reflect" - sync "sync" - _ "google.golang.org/genproto/googleapis/api/annotations" _ "google.golang.org/genproto/googleapis/api/httpbody" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -17,6 +14,8 @@ import ( _ "google.golang.org/protobuf/types/known/anypb" _ "google.golang.org/protobuf/types/known/emptypb" _ "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" ) const ( diff --git a/example/grpc-service/buf/v1/hello.pb.gw.go b/example/grpc-service/buf/v1/hello.pb.gw.go index 350710b..0574084 100644 --- a/example/grpc-service/buf/v1/hello.pb.gw.go +++ b/example/grpc-service/buf/v1/hello.pb.gw.go @@ -77,7 +77,7 @@ func RegisterGreeterServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/buf.v1.GreeterService/SayHello") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/buf.v1.GreeterService/SayHello", runtime.WithHTTPPathPattern("/rpc/v1/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -139,7 +139,7 @@ func RegisterGreeterServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/buf.v1.GreeterService/SayHello") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/buf.v1.GreeterService/SayHello", runtime.WithHTTPPathPattern("/rpc/v1/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/example/grpc-service/buf/v1/hello_grpc.pb.go b/example/grpc-service/buf/v1/hello_grpc.pb.go index 8a27c98..eee444d 100644 --- a/example/grpc-service/buf/v1/hello_grpc.pb.go +++ b/example/grpc-service/buf/v1/hello_grpc.pb.go @@ -4,7 +4,6 @@ package v1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/example/grpc-service/go.mod b/example/grpc-service/go.mod index 1934aac..7d8aa88 100644 --- a/example/grpc-service/go.mod +++ b/example/grpc-service/go.mod @@ -3,14 +3,14 @@ module grpc-service go 1.16 require ( - github.com/envoyproxy/protoc-gen-validate v0.1.0 + github.com/envoyproxy/protoc-gen-validate v0.6.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 - github.com/labstack/echo/v4 v4.4.0 + github.com/labstack/echo/v4 v4.5.0 github.com/stretchr/testify v1.7.0 - github.com/xinpianchang/xservice v1.0.13 - go.uber.org/zap v1.18.1 - google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea - google.golang.org/grpc v1.39.0 + github.com/xinpianchang/xservice v1.0.20 + go.uber.org/zap v1.19.0 + google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 + google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/example/rest-service/go.mod b/example/rest-service/go.mod index 5b3f378..20d8828 100644 --- a/example/rest-service/go.mod +++ b/example/rest-service/go.mod @@ -3,8 +3,8 @@ module rest-service go 1.16 require ( - github.com/labstack/echo/v4 v4.4.0 - github.com/xinpianchang/xservice v1.0.13 + github.com/labstack/echo/v4 v4.5.0 + github.com/xinpianchang/xservice v1.0.20 ) replace github.com/xinpianchang/xservice => ../../