Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ran `go run ./internal/cmd/fetcher plugins/grpc-ecosystem ` and updated the patch for the version. [upstream release changelog](grpc-ecosystem/grpc-gateway@v2.20.0...v2.21.0) Patch diff: ``` diff plugins/grpc-ecosystem/gateway/v2.21.0/separate_pkg_additional_imports.patch plugins/grpc-ecosystem/gateway/v2.20.0/separate_pkg_additional_imports.patch 71c71 < index 684fc5b6..c1b69363 100644 --- > index 421c0089..26bed31a 100644 88c88 < @@ -255,6 +262,9 @@ func (r *Registry) loadFile(filePath string, file *protogen.File) { --- > @@ -252,6 +259,9 @@ func (r *Registry) loadFile(filePath string, file *protogen.File) { 577c577 < index 9975e424..13332ef7 100644 --- > index ffe4d413..fdd9bc5b 100644 649c649 < @@ -606,6 +624,9 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct --- > @@ -606,12 +624,18 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct 659c659 < @@ -613,6 +634,9 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct --- > // UnaryRPC :call {{$svc.GetName}}Server directly. 662d661 < // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. 669c668 < @@ -664,6 +688,7 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, --- > @@ -663,6 +687,7 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, 677c676 < @@ -671,6 +696,9 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, --- > @@ -670,6 +695,9 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, 687c686 < @@ -693,18 +721,26 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint(ctx context.Co --- > @@ -692,18 +720,26 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint(ctx context.Co 707c706 < // "{{$svc.InstanceName}}Client" to call the correct interceptors. This client ignores the HTTP middlewares. --- > // "{{$svc.InstanceName}}Client" to call the correct interceptors. 714c713 < @@ -785,5 +821,9 @@ var ( --- > @@ -784,5 +820,9 @@ var ( 726c725 < index 086a4624..5f65b894 100644 --- > index 5a1e6977..7e89ad1c 100644 737c736 < @@ -36,6 +37,7 @@ var ( --- > @@ -35,6 +36,7 @@ var ( 745c744 < @@ -73,15 +75,22 @@ func main() { --- > @@ -58,15 +60,22 @@ func main() { 772c771 < @@ -135,6 +144,7 @@ func applyFlags(reg *descriptor.Registry) error { --- > @@ -120,6 +129,7 @@ func applyFlags(reg *descriptor.Registry) error { ``` Upstream diff in plugin ``` git --no-pager diff v2.20.0..v2.21.0 protoc-gen-grpc-gateway diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index ffe4d413..9975e424 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -612,6 +612,7 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending grpc/grpc-go#906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.InstanceName}}Server) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} @@ -703,7 +704,7 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}(ctx context.Context, mux * // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "{{$svc.InstanceName}}Client". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "{{$svc.InstanceName}}Client" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "{{$svc.InstanceName}}Client" to call the correct interceptors. +// "{{$svc.InstanceName}}Client" to call the correct interceptors. This client ignores the HTTP middlewares. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx context.Context, mux *runtime.ServeMux, client {{$svc.InstanceName}}Client) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 5a1e6977..086a4624 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -13,6 +13,7 @@ import ( "flag" "fmt" "os" + "runtime/debug" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" @@ -50,6 +51,20 @@ func main() { flag.Parse() if *versionFlag { + if commit == "unknown" { + buildInfo, ok := debug.ReadBuildInfo() + if ok { + version = buildInfo.Main.Version + for _, setting := range buildInfo.Settings { + if setting.Key == "vcs.revision" { + commit = setting.Value + } + if setting.Key == "vcs.time" { + date = setting.Value + } + } + } + } fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) os.Exit(0) } ```
- Loading branch information