From 872b49a39a9700e5573096bb6a575e7889b823e0 Mon Sep 17 00:00:00 2001 From: liyanan Date: Tue, 4 Jul 2017 13:05:46 +0800 Subject: [PATCH] echopb/Makefile: fix proto search path, and update generated file --- README.md | 4 ++-- echopb/Makefile | 6 +++--- echopb/service.pb.gw.go | 13 +++++-------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 124a5f4..9eff23d 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ To try it all out do this: ``` $ git clone https://github.com/philips/grpc-gateway-example.git $ glide install -$ go install ./vender/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway -$ go install ./vender/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +$ go install ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +$ go install ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger $ go build $ grpc-gateway-example serve $ grpc-gateway-example echo "my first rpc echo" diff --git a/echopb/Makefile b/echopb/Makefile index 96b74a8..b6ed92b 100644 --- a/echopb/Makefile +++ b/echopb/Makefile @@ -1,17 +1,17 @@ all: protoc -I/usr/local/include -I. \ -I${GOPATH}/src \ - -I../github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + -I../vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --go_out=plugins=grpc:. \ service.proto protoc -I/usr/local/include -I. \ -I${GOPATH}/src \ - -I../github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + -I../vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --grpc-gateway_out=logtostderr=true:. \ service.proto protoc -I/usr/local/include -I. \ -I${GOPATH}/src \ - -I../github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + -I../vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --swagger_out=logtostderr=true:. \ service.proto go generate . diff --git a/echopb/service.pb.gw.go b/echopb/service.pb.gw.go index 3c8598e..8d5721b 100644 --- a/echopb/service.pb.gw.go +++ b/echopb/service.pb.gw.go @@ -20,12 +20,10 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" ) var _ codes.Code var _ io.Reader -var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray @@ -34,7 +32,7 @@ func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -85,19 +83,18 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) } resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_EchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) })