From b820a763a2d346db6240ec49c8d0ddb5b797378a Mon Sep 17 00:00:00 2001 From: makdon Date: Fri, 31 May 2024 23:15:49 +0800 Subject: [PATCH] feat: use buildInfo.Main.Version as version --- protoc-gen-grpc-gateway/main.go | 3 +-- protoc-gen-openapiv2/main.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 503f15c5590..086a4624d37 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -54,6 +54,7 @@ func main() { 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 @@ -62,8 +63,6 @@ func main() { date = setting.Value } } - fmt.Printf("commit %v, built at %v\n", commit, date) - os.Exit(0) } } fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) diff --git a/protoc-gen-openapiv2/main.go b/protoc-gen-openapiv2/main.go index 8552c7eb882..340833d01a2 100644 --- a/protoc-gen-openapiv2/main.go +++ b/protoc-gen-openapiv2/main.go @@ -67,6 +67,7 @@ func main() { 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 @@ -75,8 +76,6 @@ func main() { date = setting.Value } } - fmt.Printf("commit %v, built at %v\n", commit, date) - os.Exit(0) } } fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date)