diff --git a/Makefile b/Makefile index 92da377f8ea..3b953942f6d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +# This is a Makefile which maintains files automatically generated but to be +# shipped together with other files. +# You don't have to rebuild these targets by yourself unless you develop +# grpc-gateway itself. + PKG=github.com/gengo/grpc-gateway GO_PLUGIN=bin/protoc-gen-go GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go @@ -55,9 +60,11 @@ test: examples go test $(PKG)/... clean distclean: -realclean: + rm -f $(GATEWAY_PLUGIN) +realclean: distclean rm -f $(OPTIONS_GO) rm -f $(EXAMPLE_SVCSRCS) $(EXAMPLE_DEPSRCS) rm -f $(EXAMPLE_GWSRCS) + rm -f $(GO_PLUGIN) .PHONY: generate examples test clean distclean realclean diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 5c9f422c36e..582ed7eff82 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -14,10 +14,6 @@ import ( grpc "google.golang.org/grpc" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -77,6 +73,10 @@ func (m *IdMessage) Reset() { *m = IdMessage{} } func (m *IdMessage) String() string { return proto.CompactTextString(m) } func (*IdMessage) ProtoMessage() {} +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + // Client API for ABitOfEverythingService service type ABitOfEverythingServiceClient interface { diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index daf0fac99d9..80a74f5fadd 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -23,10 +23,6 @@ import ( grpc "google.golang.org/grpc" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -38,6 +34,10 @@ func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } func (*SimpleMessage) ProtoMessage() {} +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + // Client API for EchoService service type EchoServiceClient interface { diff --git a/runtime/context_test.go b/runtime/context_test.go index 4e1bec641f6..d004a0f3dfc 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -2,6 +2,7 @@ package runtime_test import ( "net/http" + "reflect" "testing" "github.com/gengo/grpc-gateway/runtime" @@ -25,10 +26,10 @@ func TestAnnotateContext(t *testing.T) { if !ok || len(md) != 2 { t.Errorf("Expected 2 metadata items in context; got %v", md) } - if md["Foobar"] != "Value1" { - t.Errorf("md[\"Foobar\"] = %v; want %v", md["Foobar"], "Value1") + if got, want := md["Foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { + t.Errorf("md[\"Foobar\"] = %v; want %v", got, want) } - if md["Foo-Baz"] != "Value2" { - t.Errorf("md[\"Foo-Baz\"] = %v want %v", md["Foo-Baz"], "Value2") + if got, want := md["Foo-Baz"], []string{"Value2"}; !reflect.DeepEqual(got, want) { + t.Errorf("md[\"Foo-Baz\"] = %v want %v", got, want) } }