Skip to content

Commit

Permalink
Add version.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Nov 23, 2020
1 parent 49b267d commit e4039ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"runtime"
"strings"
"text/template"
"time"
)

// Build information. Populated at build-time.
Expand All @@ -29,6 +30,7 @@ var (
BuildUser string
BuildDate string
GoVersion = runtime.Version()
Started = time.Now()
)

// versionInfoTmpl contains the template used by Info.
Expand All @@ -38,11 +40,13 @@ const versionInfoTmpl = `
build date: {{.buildDate}}
go version: {{.goVersion}}
platform: {{.platform}}
started: {{.started}}
`

// Print returns version information.
func Print(program string) string {
m := map[string]string{
"started": Started.String(),
"program": program,
"version": Version,
"revision": Revision,
Expand Down

0 comments on commit e4039ae

Please sign in to comment.