Skip to content

Commit

Permalink
feat: use buildInfo.Main.Version as version (#4390)
Browse files Browse the repository at this point in the history
  • Loading branch information
MakDon authored May 31, 2024
1 parent 98140e1 commit a94bb9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions protoc-gen-grpc-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions protoc-gen-openapiv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit a94bb9d

Please sign in to comment.