Skip to content

Commit

Permalink
revad: print build information on startup (#186)
Browse files Browse the repository at this point in the history
* revad: print version on startup (#67)

* doc: update contributors
  • Loading branch information
unixlab authored and labkode committed Aug 12, 2019
1 parent be444f0 commit 5bdbb77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Felix Hillingshaeuser <felix@mxcore.de>
- Hugo Gonzalez Labrador <github@hugo.labkode.com>
- Jörn Friedrich Dreyer <jfd@butonic.de>
- Mohitty <mohitt@iitk.ac.in>
21 changes: 13 additions & 8 deletions cmd/revad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func main() {
log.Error().Err(err).Msg("error adjusting number of cpus")
watcher.Exit(1)
}
log.Info().Msgf("%s", getVersionString())
log.Info().Msgf("running on %d cpus", ncpus)

servers := []grace.Server{}
Expand Down Expand Up @@ -161,16 +162,20 @@ func getWriter(out string) (io.Writer, error) {
return fd, nil
}

func getVersionString() string {
msg := "version=%s "
msg += "commit=%s "
msg += "branch=%s "
msg += "go_version=%s "
msg += "build_date=%s "
msg += "build_platform=%s\n"

return fmt.Sprintf(msg, version, gitCommit, gitBranch, goVersion, buildDate, buildPlatform)
}

func handleVersionFlag() {
if *versionFlag {
msg := "version=%s "
msg += "commit=%s "
msg += "branch=%s "
msg += "go_version=%s "
msg += "build_date=%s "
msg += "build_platform=%s\n"

fmt.Fprintf(os.Stderr, msg, version, gitCommit, gitBranch, goVersion, buildDate, buildPlatform)
fmt.Fprintf(os.Stderr, getVersionString())
os.Exit(1)
}
}
Expand Down

0 comments on commit 5bdbb77

Please sign in to comment.