From f75e6a762b985029232b7e7c18b8c29108484d7f Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 28 Apr 2020 20:56:50 +0100 Subject: [PATCH] Minimize public API As previously attempted on v1, so it shall be on v2. We want to minimize the public API surface to more easily allow changes that won't break users. --- Makefile | 66 +++++++++---------- examples/internal/helloworld/BUILD.bazel | 2 +- .../internal/helloworld/helloworld.pb.gw.go | 2 +- examples/internal/proto/examplepb/BUILD.bazel | 2 +- .../examplepb/a_bit_of_everything.pb.gw.go | 2 +- .../proto/examplepb/echo_service.pb.gw.go | 2 +- .../proto/examplepb/flow_combination.pb.gw.go | 2 +- .../examplepb/non_standard_names.pb.gw.go | 2 +- .../examplepb/response_body_service.pb.gw.go | 2 +- .../internal/proto/examplepb/stream.pb.gw.go | 2 +- .../unannotated_echo_service.pb.gw.go | 2 +- .../proto/examplepb/use_go_template.pb.gw.go | 2 +- .../proto/examplepb/wrappers.pb.gw.go | 2 +- .../internal/proto/standalone/BUILD.bazel | 2 +- .../unannotated_echo_service.pb.gw.go | 2 +- fuzzit.sh | 4 +- go.mod | 1 + go.sum | 3 + .../codegenerator}/BUILD.bazel | 2 +- .../codegenerator}/doc.go | 0 .../codegenerator}/parse_req.go | 0 .../codegenerator}/parse_req_test.go | 2 +- .../descriptor/BUILD.bazel | 6 +- .../descriptor/grpc_api_configuration.go | 0 .../descriptor/grpc_api_configuration_test.go | 0 .../descriptor/grpc_api_service.go | 0 .../descriptor/registry.go | 0 .../descriptor/registry_test.go | 0 .../descriptor/services.go | 2 +- .../descriptor/services_test.go | 2 +- .../descriptor/types.go | 2 +- .../descriptor/types_test.go | 0 .../generator/BUILD.bazel | 4 +- .../generator/generator.go | 2 +- .../httprule/BUILD.bazel | 6 +- .../httprule/compile.go | 2 +- .../httprule/compile_test.go | 2 +- .../httprule/fuzz.go | 0 .../httprule/parse.go | 0 .../httprule/parse_test.go | 0 .../httprule/types.go | 0 .../httprule/types_test.go | 0 {utilities => internal/utilities}/BUILD.bazel | 2 +- {utilities => internal/utilities}/doc.go | 0 {utilities => internal/utilities}/pattern.go | 0 .../utilities}/readerfactory.go | 0 {utilities => internal/utilities}/trie.go | 0 .../utilities}/trie_test.go | 2 +- protoc-gen-grpc-gateway/BUILD.bazel | 6 +- .../internal/gengateway/BUILD.bazel | 10 +-- .../internal/gengateway/generator.go | 6 +- .../internal/gengateway/generator_test.go | 2 +- .../internal/gengateway/template.go | 4 +- .../internal/gengateway/template_test.go | 4 +- protoc-gen-grpc-gateway/main.go | 4 +- protoc-gen-swagger/BUILD.bazel | 6 +- .../{ => internal}/genswagger/BUILD.bazel | 10 +-- .../{ => internal}/genswagger/doc.go | 0 .../{ => internal}/genswagger/generator.go | 4 +- .../{ => internal}/genswagger/helpers.go | 0 .../genswagger/helpers_go111_old.go | 0 .../{ => internal}/genswagger/template.go | 2 +- .../genswagger/template_test.go | 4 +- .../{ => internal}/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 6 +- repositories.bzl | 4 +- runtime/BUILD.bazel | 4 +- runtime/mux_test.go | 2 +- runtime/pattern.go | 2 +- runtime/pattern_test.go | 2 +- runtime/query.go | 2 +- runtime/query_test.go | 2 +- 72 files changed, 115 insertions(+), 111 deletions(-) rename {codegenerator => internal/codegenerator}/BUILD.bazel (90%) rename {codegenerator => internal/codegenerator}/doc.go (100%) rename {codegenerator => internal/codegenerator}/parse_req.go (100%) rename {codegenerator => internal/codegenerator}/parse_req_test.go (95%) rename {protoc-gen-grpc-gateway => internal}/descriptor/BUILD.bazel (85%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_configuration.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_configuration_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_service.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/registry.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/registry_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/services.go (99%) rename {protoc-gen-grpc-gateway => internal}/descriptor/services_test.go (99%) rename {protoc-gen-grpc-gateway => internal}/descriptor/types.go (99%) rename {protoc-gen-grpc-gateway => internal}/descriptor/types_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/generator/BUILD.bazel (62%) rename {protoc-gen-grpc-gateway => internal}/generator/generator.go (82%) rename {protoc-gen-grpc-gateway => internal}/httprule/BUILD.bazel (76%) rename {protoc-gen-grpc-gateway => internal}/httprule/compile.go (97%) rename {protoc-gen-grpc-gateway => internal}/httprule/compile_test.go (97%) rename {protoc-gen-grpc-gateway => internal}/httprule/fuzz.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/parse.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/parse_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/types.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/types_test.go (100%) rename {utilities => internal/utilities}/BUILD.bazel (83%) rename {utilities => internal/utilities}/doc.go (100%) rename {utilities => internal/utilities}/pattern.go (100%) rename {utilities => internal/utilities}/readerfactory.go (100%) rename {utilities => internal/utilities}/trie.go (100%) rename {utilities => internal/utilities}/trie_test.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/BUILD.bazel (84%) rename protoc-gen-swagger/{ => internal}/genswagger/doc.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/generator.go (97%) rename protoc-gen-swagger/{ => internal}/genswagger/helpers.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/helpers_go111_old.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/template.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/template_test.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/types.go (99%) diff --git a/Makefile b/Makefile index 8bfb0e46148..3fd1777f54d 100644 --- a/Makefile +++ b/Makefile @@ -8,36 +8,36 @@ GO_PROTOBUF_REPO=github.com/golang/protobuf GO_PLUGIN_PKG=$(GO_PROTOBUF_REPO)/protoc-gen-go GO_PTYPES_ANY_PKG=$(GO_PROTOBUF_REPO)/ptypes/any SWAGGER_PLUGIN=bin/protoc-gen-swagger -SWAGGER_PLUGIN_SRC= utilities/doc.go \ - utilities/pattern.go \ - utilities/trie.go \ - protoc-gen-swagger/genswagger/generator.go \ - protoc-gen-swagger/genswagger/template.go \ - protoc-gen-swagger/main.go +SWAGGER_PLUGIN_SRC= ./internal/utilities/doc.go \ + ./internal/utilities/pattern.go \ + ./internal/utilities/trie.go \ + protoc-gen-swagger/internal/genswagger/generator.go \ + protoc-gen-swagger/internal/genswagger/template.go \ + protoc-gen-swagger/main.go SWAGGER_PLUGIN_PKG=./protoc-gen-swagger GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway GATEWAY_PLUGIN_PKG=./protoc-gen-grpc-gateway -GATEWAY_PLUGIN_SRC= utilities/doc.go \ - utilities/pattern.go \ - utilities/trie.go \ - protoc-gen-grpc-gateway \ - protoc-gen-grpc-gateway/descriptor \ - protoc-gen-grpc-gateway/descriptor/registry.go \ - protoc-gen-grpc-gateway/descriptor/services.go \ - protoc-gen-grpc-gateway/descriptor/types.go \ - protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go \ - protoc-gen-grpc-gateway/descriptor/grpc_api_service.go \ - protoc-gen-grpc-gateway/generator \ - protoc-gen-grpc-gateway/generator/generator.go \ - protoc-gen-grpc-gateway/internal/gengateway \ - protoc-gen-grpc-gateway/internal/gengateway/doc.go \ - protoc-gen-grpc-gateway/internal/gengateway/generator.go \ - protoc-gen-grpc-gateway/internal/gengateway/template.go \ - protoc-gen-grpc-gateway/httprule \ - protoc-gen-grpc-gateway/httprule/compile.go \ - protoc-gen-grpc-gateway/httprule/parse.go \ - protoc-gen-grpc-gateway/httprule/types.go \ - protoc-gen-grpc-gateway/main.go +GATEWAY_PLUGIN_SRC= ./internal/utilities/doc.go \ + ./internal/utilities/pattern.go \ + ./internal/utilities/trie.go \ + ./internal/descriptor \ + ./internal/descriptor/registry.go \ + ./internal/descriptor/services.go \ + ./internal/descriptor/types.go \ + ./internal/descriptor/grpc_api_configuration.go \ + ./internal/descriptor/grpc_api_service.go \ + ./internal/generator \ + ./internal/generator/generator.go \ + protoc-gen-grpc-gateway \ + protoc-gen-grpc-gateway/internal/gengateway \ + protoc-gen-grpc-gateway/internal/gengateway/doc.go \ + protoc-gen-grpc-gateway/internal/gengateway/generator.go \ + protoc-gen-grpc-gateway/internal/gengateway/template.go \ + internal/httprule \ + internal/httprule/compile.go \ + internal/httprule/parse.go \ + internal/httprule/types.go \ + protoc-gen-grpc-gateway/main.go GATEWAY_PLUGIN_FLAGS?= SWAGGER_PLUGIN_FLAGS?= @@ -194,22 +194,22 @@ $(HELLOWORLD_GWSRCS): $(GATEWAY_PLUGIN) $(HELLOWORLD) $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ - -l go -o examples/internal/clients/echo --additional-properties packageName=echo + -l go -o examples/internal/clients/echo --additional-properties packageName=echo @rm -f $(EXAMPLE_CLIENT_DIR)/echo/README.md \ $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh $(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ - -l go -o examples/internal/clients/abe --additional-properties packageName=abe + -l go -o examples/internal/clients/abe --additional-properties packageName=abe @rm -f $(EXAMPLE_CLIENT_DIR)/abe/README.md \ $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh $(UNANNOTATED_ECHO_EXAMPLE_SRCS): $(UNANNOTATED_ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(UNANNOTATED_ECHO_EXAMPLE_SPEC) \ - -l go -o examples/internal/clients/unannotatedecho --additional-properties packageName=unannotatedecho + -l go -o examples/internal/clients/unannotatedecho --additional-properties packageName=unannotatedecho @rm -f $(EXAMPLE_CLIENT_DIR)/unannotatedecho/README.md \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/git_push.sh $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(RESPONSE_BODY_EXAMPLE_SPEC) \ - -l go -o examples/internal/clients/responsebody --additional-properties packageName=responsebody + -l go -o examples/internal/clients/responsebody --additional-properties packageName=responsebody @rm -f $(EXAMPLE_CLIENT_DIR)/responsebody/README.md \ $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh @@ -234,11 +234,11 @@ changelog: --future-release=v1.14.4 lint: golint --set_exit_status ./runtime - golint --set_exit_status ./utilities/... + golint --set_exit_status ././internal/utilities/... golint --set_exit_status ./protoc-gen-grpc-gateway/... golint --set_exit_status ./protoc-gen-swagger/... go vet ./runtime || true - go vet ./utilities/... + go vet ././internal/utilities/... go vet ./protoc-gen-grpc-gateway/... go vet ./protoc-gen-swagger/... diff --git a/examples/internal/helloworld/BUILD.bazel b/examples/internal/helloworld/BUILD.bazel index c389c3b0a98..0ae7affc43e 100644 --- a/examples/internal/helloworld/BUILD.bazel +++ b/examples/internal/helloworld/BUILD.bazel @@ -28,8 +28,8 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld", visibility = ["//visibility:public"], deps = [ + "//internal/utilities:go_default_library", "//runtime:go_default_library", - "//utilities:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/examples/internal/helloworld/helloworld.pb.gw.go b/examples/internal/helloworld/helloworld.pb.gw.go index 95610308f77..1b3f5f3fe96 100644 --- a/examples/internal/helloworld/helloworld.pb.gw.go +++ b/examples/internal/helloworld/helloworld.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 199454cbb06..ad808e9525c 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -76,8 +76,8 @@ go_library( embed = [":examplepb_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", deps = [ + "//internal/utilities:go_default_library", "//runtime:go_default_library", - "//utilities:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go index 1411db2c963..e3323be04c8 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -19,8 +19,8 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/echo_service.pb.gw.go b/examples/internal/proto/examplepb/echo_service.pb.gw.go index d467c0d4986..f8565564d5a 100644 --- a/examples/internal/proto/examplepb/echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/echo_service.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/flow_combination.pb.gw.go b/examples/internal/proto/examplepb/flow_combination.pb.gw.go index c876352a770..728b3207211 100644 --- a/examples/internal/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/internal/proto/examplepb/flow_combination.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/non_standard_names.pb.gw.go b/examples/internal/proto/examplepb/non_standard_names.pb.gw.go index 8db9cd2524f..47f52be92a0 100644 --- a/examples/internal/proto/examplepb/non_standard_names.pb.gw.go +++ b/examples/internal/proto/examplepb/non_standard_names.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/response_body_service.pb.gw.go b/examples/internal/proto/examplepb/response_body_service.pb.gw.go index 6da76968937..52480625cad 100644 --- a/examples/internal/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/stream.pb.gw.go b/examples/internal/proto/examplepb/stream.pb.gw.go index 26b49643961..66500a5818c 100644 --- a/examples/internal/proto/examplepb/stream.pb.gw.go +++ b/examples/internal/proto/examplepb/stream.pb.gw.go @@ -17,8 +17,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go index 929fa6a3199..770c4f6e8da 100644 --- a/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/use_go_template.pb.gw.go b/examples/internal/proto/examplepb/use_go_template.pb.gw.go index dc561fb2d27..cda68521f19 100644 --- a/examples/internal/proto/examplepb/use_go_template.pb.gw.go +++ b/examples/internal/proto/examplepb/use_go_template.pb.gw.go @@ -15,8 +15,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/examplepb/wrappers.pb.gw.go b/examples/internal/proto/examplepb/wrappers.pb.gw.go index 7aa1045b625..722174ae3f8 100644 --- a/examples/internal/proto/examplepb/wrappers.pb.gw.go +++ b/examples/internal/proto/examplepb/wrappers.pb.gw.go @@ -17,8 +17,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/wrappers" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/internal/proto/standalone/BUILD.bazel b/examples/internal/proto/standalone/BUILD.bazel index a5c303f02e7..e1dbc0835fa 100644 --- a/examples/internal/proto/standalone/BUILD.bazel +++ b/examples/internal/proto/standalone/BUILD.bazel @@ -7,8 +7,8 @@ go_library( visibility = ["//examples:__subpackages__"], deps = [ "//examples/internal/proto/examplepb:go_default_library", + "//internal/utilities:go_default_library", "//runtime:go_default_library", - "//utilities:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/examples/internal/proto/standalone/unannotated_echo_service.pb.gw.go b/examples/internal/proto/standalone/unannotated_echo_service.pb.gw.go index acd19da52f7..34d5d39c073 100644 --- a/examples/internal/proto/standalone/unannotated_echo_service.pb.gw.go +++ b/examples/internal/proto/standalone/unannotated_echo_service.pb.gw.go @@ -16,8 +16,8 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" extExamplepb "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/fuzzit.sh b/fuzzit.sh index e5df5f3f843..43c0f23918b 100755 --- a/fuzzit.sh +++ b/fuzzit.sh @@ -9,9 +9,9 @@ cd go-fuzz go get ./... go build ./... -#go get -v -u ./protoc-gen-grpc-gateway/httprule +#go get -v -u ./internal/httprule cd /src/grpc-gateway -go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule +go-fuzz-build -libfuzzer -o parse-http-rule.a ./internal/httprule clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 diff --git a/go.mod b/go.mod index a8497875276..ca9f273fa5c 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/rogpeppe/fastuuid v1.2.0 golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 // indirect golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be + golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24 // indirect google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c google.golang.org/grpc v1.27.1 google.golang.org/protobuf v1.21.0 diff --git a/go.sum b/go.sum index c5bd3afd4b5..3a45774ec19 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4 h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -47,6 +48,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24 h1:R8bzl0244nw47n1xKs1MUMAaTNgjavKcN/aX2Ss3+Fo= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/codegenerator/BUILD.bazel b/internal/codegenerator/BUILD.bazel similarity index 90% rename from codegenerator/BUILD.bazel rename to internal/codegenerator/BUILD.bazel index df1beb39ab7..9d0aa3741f1 100644 --- a/codegenerator/BUILD.bazel +++ b/internal/codegenerator/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "doc.go", "parse_req.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator", deps = [ "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/codegenerator/doc.go b/internal/codegenerator/doc.go similarity index 100% rename from codegenerator/doc.go rename to internal/codegenerator/doc.go diff --git a/codegenerator/parse_req.go b/internal/codegenerator/parse_req.go similarity index 100% rename from codegenerator/parse_req.go rename to internal/codegenerator/parse_req.go diff --git a/codegenerator/parse_req_test.go b/internal/codegenerator/parse_req_test.go similarity index 95% rename from codegenerator/parse_req_test.go rename to internal/codegenerator/parse_req_test.go index a75b64a4771..c2eb9e757ed 100644 --- a/codegenerator/parse_req_test.go +++ b/internal/codegenerator/parse_req_test.go @@ -11,7 +11,7 @@ import ( "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/google/go-cmp/cmp" - "github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" "google.golang.org/protobuf/testing/protocmp" ) diff --git a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/internal/descriptor/BUILD.bazel similarity index 85% rename from protoc-gen-grpc-gateway/descriptor/BUILD.bazel rename to internal/descriptor/BUILD.bazel index 433ce26bb4e..aab8c6527a7 100644 --- a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel +++ b/internal/descriptor/BUILD.bazel @@ -11,9 +11,9 @@ go_library( "services.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor", deps = [ - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/httprule:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", @@ -36,7 +36,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go b/internal/descriptor/grpc_api_configuration.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go rename to internal/descriptor/grpc_api_configuration.go diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go b/internal/descriptor/grpc_api_configuration_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go rename to internal/descriptor/grpc_api_configuration_test.go diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go b/internal/descriptor/grpc_api_service.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_service.go rename to internal/descriptor/grpc_api_service.go diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/internal/descriptor/registry.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/registry.go rename to internal/descriptor/registry.go diff --git a/protoc-gen-grpc-gateway/descriptor/registry_test.go b/internal/descriptor/registry_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/registry_test.go rename to internal/descriptor/registry_test.go diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/internal/descriptor/services.go similarity index 99% rename from protoc-gen-grpc-gateway/descriptor/services.go rename to internal/descriptor/services.go index 1e7e4a58f1a..b85e6d47922 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/internal/descriptor/services.go @@ -7,7 +7,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" options "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/internal/descriptor/services_test.go similarity index 99% rename from protoc-gen-grpc-gateway/descriptor/services_test.go rename to internal/descriptor/services_test.go index 18915aba853..bc984aae966 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/internal/descriptor/services_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/internal/descriptor/types.go similarity index 99% rename from protoc-gen-grpc-gateway/descriptor/types.go rename to internal/descriptor/types.go index a0676e55965..c7c1baa2316 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/internal/descriptor/types.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" ) // IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'. diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/internal/descriptor/types_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/types_test.go rename to internal/descriptor/types_test.go diff --git a/protoc-gen-grpc-gateway/generator/BUILD.bazel b/internal/generator/BUILD.bazel similarity index 62% rename from protoc-gen-grpc-gateway/generator/BUILD.bazel rename to internal/generator/BUILD.bazel index 4c6864ab0e7..d1d3c9a0281 100644 --- a/protoc-gen-grpc-gateway/generator/BUILD.bazel +++ b/internal/generator/BUILD.bazel @@ -5,9 +5,9 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = ["generator.go"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/generator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator", deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//internal/descriptor:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/internal/generator/generator.go similarity index 82% rename from protoc-gen-grpc-gateway/generator/generator.go rename to internal/generator/generator.go index c927ec692fc..21255eaa95b 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/internal/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/httprule/BUILD.bazel b/internal/httprule/BUILD.bazel similarity index 76% rename from protoc-gen-grpc-gateway/httprule/BUILD.bazel rename to internal/httprule/BUILD.bazel index df87e3bd87c..5fda2f0a60a 100644 --- a/protoc-gen-grpc-gateway/httprule/BUILD.bazel +++ b/internal/httprule/BUILD.bazel @@ -9,9 +9,9 @@ go_library( "parse.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule", deps = [ - "//utilities:go_default_library", + "//internal/utilities:go_default_library", "@com_github_golang_glog//:go_default_library", ], ) @@ -26,7 +26,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//utilities:go_default_library", + "//internal/utilities:go_default_library", "@com_github_golang_glog//:go_default_library", ], ) diff --git a/protoc-gen-grpc-gateway/httprule/compile.go b/internal/httprule/compile.go similarity index 97% rename from protoc-gen-grpc-gateway/httprule/compile.go rename to internal/httprule/compile.go index 162319d3f3b..1a4a9ed1e53 100644 --- a/protoc-gen-grpc-gateway/httprule/compile.go +++ b/internal/httprule/compile.go @@ -1,7 +1,7 @@ package httprule import ( - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/httprule/compile_test.go b/internal/httprule/compile_test.go similarity index 97% rename from protoc-gen-grpc-gateway/httprule/compile_test.go rename to internal/httprule/compile_test.go index 2996b99e613..6ab50edac84 100644 --- a/protoc-gen-grpc-gateway/httprule/compile_test.go +++ b/internal/httprule/compile_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/httprule/fuzz.go b/internal/httprule/fuzz.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/fuzz.go rename to internal/httprule/fuzz.go diff --git a/protoc-gen-grpc-gateway/httprule/parse.go b/internal/httprule/parse.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/parse.go rename to internal/httprule/parse.go diff --git a/protoc-gen-grpc-gateway/httprule/parse_test.go b/internal/httprule/parse_test.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/parse_test.go rename to internal/httprule/parse_test.go diff --git a/protoc-gen-grpc-gateway/httprule/types.go b/internal/httprule/types.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/types.go rename to internal/httprule/types.go diff --git a/protoc-gen-grpc-gateway/httprule/types_test.go b/internal/httprule/types_test.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/types_test.go rename to internal/httprule/types_test.go diff --git a/utilities/BUILD.bazel b/internal/utilities/BUILD.bazel similarity index 83% rename from utilities/BUILD.bazel rename to internal/utilities/BUILD.bazel index 6bb7df467fb..1a6d50e339a 100644 --- a/utilities/BUILD.bazel +++ b/internal/utilities/BUILD.bazel @@ -10,7 +10,7 @@ go_library( "readerfactory.go", "trie.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities", ) go_test( diff --git a/utilities/doc.go b/internal/utilities/doc.go similarity index 100% rename from utilities/doc.go rename to internal/utilities/doc.go diff --git a/utilities/pattern.go b/internal/utilities/pattern.go similarity index 100% rename from utilities/pattern.go rename to internal/utilities/pattern.go diff --git a/utilities/readerfactory.go b/internal/utilities/readerfactory.go similarity index 100% rename from utilities/readerfactory.go rename to internal/utilities/readerfactory.go diff --git a/utilities/trie.go b/internal/utilities/trie.go similarity index 100% rename from utilities/trie.go rename to internal/utilities/trie.go diff --git a/utilities/trie_test.go b/internal/utilities/trie_test.go similarity index 99% rename from utilities/trie_test.go rename to internal/utilities/trie_test.go index 615aafb2458..4e219e1b0ed 100644 --- a/utilities/trie_test.go +++ b/internal/utilities/trie_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" ) func TestMaxCommonPrefix(t *testing.T) { diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index e39d75d3844..09851518641 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -8,8 +8,8 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway", deps = [ - "//codegenerator:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//internal/codegenerator:go_default_library", + "//internal/descriptor:go_default_library", "//protoc-gen-grpc-gateway/internal/gengateway:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", @@ -33,8 +33,8 @@ go_proto_compiler( suffix = ".pb.gw.go", visibility = ["//visibility:public"], deps = [ + "//internal/utilities:go_default_library", "//runtime:go_default_library", - "//utilities:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", diff --git a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index 3c5d722ca87..94f59180769 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -11,9 +11,9 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway", deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/generator:go_default_library", - "//utilities:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/generator:go_default_library", + "//internal/utilities:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", @@ -30,8 +30,8 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator.go b/protoc-gen-grpc-gateway/internal/gengateway/generator.go index 44f1e6e9507..16d2513a557 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/generator" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" ) var ( @@ -45,7 +45,7 @@ func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, p "io", "net/http", "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities", "github.com/golang/protobuf/descriptor", "github.com/golang/protobuf/proto", "google.golang.org/grpc", diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go index d54bd03e399..0d36ff9af19 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" ) func newExampleFileDescriptor() *descriptor.File { diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index beb7475cfd5..4b6614e9fc6 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -9,8 +9,8 @@ import ( "github.com/golang/glog" generator2 "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" ) type param struct { diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 8c07e83b4a4..281fe93690b 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index dfa392d6193..5d7a4018410 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -17,8 +17,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway" ) diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index 2b5b97efbb8..f6f93625f2e 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -7,9 +7,9 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger", deps = [ - "//codegenerator:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-swagger/genswagger:go_default_library", + "//internal/codegenerator:go_default_library", + "//internal/descriptor:go_default_library", + "//protoc-gen-swagger/internal/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/internal/genswagger/BUILD.bazel similarity index 84% rename from protoc-gen-swagger/genswagger/BUILD.bazel rename to protoc-gen-swagger/internal/genswagger/BUILD.bazel index e2b2e447a8b..f4b1cdda53f 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/internal/genswagger/BUILD.bazel @@ -12,11 +12,11 @@ go_library( "template.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/genswagger", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/internal/genswagger", deps = [ "//internal:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/generator:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/generator:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", @@ -36,8 +36,8 @@ go_test( srcs = ["template_test.go"], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/httprule:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:any_go_proto", diff --git a/protoc-gen-swagger/genswagger/doc.go b/protoc-gen-swagger/internal/genswagger/doc.go similarity index 100% rename from protoc-gen-swagger/genswagger/doc.go rename to protoc-gen-swagger/internal/genswagger/doc.go diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/internal/genswagger/generator.go similarity index 97% rename from protoc-gen-swagger/genswagger/generator.go rename to protoc-gen-swagger/internal/genswagger/generator.go index bb1fc5ae391..4d9610578cf 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/internal/genswagger/generator.go @@ -16,8 +16,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/v2/internal" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/generator" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" swagger_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/options" spb "google.golang.org/genproto/googleapis/rpc/status" ) diff --git a/protoc-gen-swagger/genswagger/helpers.go b/protoc-gen-swagger/internal/genswagger/helpers.go similarity index 100% rename from protoc-gen-swagger/genswagger/helpers.go rename to protoc-gen-swagger/internal/genswagger/helpers.go diff --git a/protoc-gen-swagger/genswagger/helpers_go111_old.go b/protoc-gen-swagger/internal/genswagger/helpers_go111_old.go similarity index 100% rename from protoc-gen-swagger/genswagger/helpers_go111_old.go rename to protoc-gen-swagger/internal/genswagger/helpers_go111_old.go diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/internal/genswagger/template.go similarity index 99% rename from protoc-gen-swagger/genswagger/template.go rename to protoc-gen-swagger/internal/genswagger/template.go index 712c2e0657d..39e44bf01bc 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/internal/genswagger/template.go @@ -19,7 +19,7 @@ import ( "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/internal/genswagger/template_test.go similarity index 99% rename from protoc-gen-swagger/genswagger/template_test.go rename to protoc-gen-swagger/internal/genswagger/template_test.go index 3636abf2b65..5c65ed52972 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/internal/genswagger/template_test.go @@ -13,8 +13,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" swagger_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/internal/genswagger/types.go similarity index 99% rename from protoc-gen-swagger/genswagger/types.go rename to protoc-gen-swagger/internal/genswagger/types.go index e561083d7a2..b0cd58ac758 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/internal/genswagger/types.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 2d6c8da6c9f..d44999a9ee0 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -9,9 +9,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/genswagger" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-swagger/internal/genswagger" ) var ( diff --git a/repositories.bzl b/repositories.bzl index e588d41340c..e8407d2934f 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -114,8 +114,8 @@ def go_repositories(): go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", - sum = "h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=", - version = "v0.0.0-20190215142949-d0b11bdaac8a", + sum = "h1:R8bzl0244nw47n1xKs1MUMAaTNgjavKcN/aX2Ss3+Fo=", + version = "v0.0.0-20191001151750-bb3f8db39f24", ) go_repository( name = "org_golang_x_text", diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 2e47dabb126..3f0c0395b9a 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -26,7 +26,7 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", deps = [ "//internal:go_default_library", - "//utilities:go_default_library", + "//internal/utilities:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", @@ -65,8 +65,8 @@ go_test( embed = [":go_default_library"], deps = [ "//internal:go_default_library", + "//internal/utilities:go_default_library", "//runtime/internal/examplepb:go_default_library", - "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//ptypes:go_default_library_gen", diff --git a/runtime/mux_test.go b/runtime/mux_test.go index 0672f271e22..21ea5d143f5 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -8,8 +8,8 @@ import ( "net/http/httptest" "testing" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/runtime/pattern.go b/runtime/pattern.go index a717ef6f1c2..c2e4bf956b0 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/pattern_test.go b/runtime/pattern_test.go index 1b856a512a4..6b7e8fc4ecc 100644 --- a/runtime/pattern_test.go +++ b/runtime/pattern_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" ) const ( diff --git a/runtime/query.go b/runtime/query.go index 13e563cf909..b7e00548a76 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -11,7 +11,7 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/query_test.go b/runtime/query_test.go index 33b6ef06fa1..f1586fe0569 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -12,9 +12,9 @@ import ( "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/wrappers" "github.com/google/go-cmp/cmp" + "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/protobuf/testing/protocmp" )