Print prettier version info
This commit is contained in:
parent
9b40934654
commit
5d896ae439
4 changed files with 32 additions and 11 deletions
26
version/version.go
Normal file
26
version/version.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
Tag = "dev"
|
||||
Commit = "none"
|
||||
Date = "unknown"
|
||||
)
|
||||
|
||||
func init() {
|
||||
vParts := strings.Split(Tag, "-")
|
||||
|
||||
if len(vParts) > 1 {
|
||||
Tag = fmt.Sprintf("%s + %s commits", vParts[0], vParts[1])
|
||||
}
|
||||
|
||||
t, err := time.Parse(time.RFC3339, Date)
|
||||
if err == nil {
|
||||
Date = t.Format("02 Jan 2006, 15:04:05")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue