Skip to content

Commit

Permalink
main: print go build info
Browse files Browse the repository at this point in the history
  • Loading branch information
jrockway committed Jan 3, 2022
1 parent e825194 commit 6d0541c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/jlog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/signal"
"runtime/debug"
"runtime/pprof"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -70,6 +71,14 @@ func main() {
if ferr, ok := err.(*flags.Error); ok && ferr.Type == flags.ErrHelp {
fmt.Fprintf(os.Stderr, "jlog - Search and pretty-print your JSON logs.\nMore info: https://github.com/jrockway/json-logs\n")
fmt.Fprintf(os.Stderr, "Version %s (%s) built on %s by %s\n", version, commit, date, builtBy)
if buildinfo, ok := debug.ReadBuildInfo(); ok {
fmt.Fprintf(os.Stderr, " built with go %v\n", buildinfo.GoVersion)
if commit == "none" {
for _, x := range buildinfo.Settings {
fmt.Fprintf(os.Stderr, " %v: %v\n", x.Key, x.Value)
}
}
}
fmt.Fprintf(os.Stderr, ferr.Message)
os.Exit(2)
}
Expand Down

0 comments on commit 6d0541c

Please sign in to comment.