diff --git a/make.go b/make.go index e8bd1c2e..d90b6a4f 100644 --- a/make.go +++ b/make.go @@ -30,9 +30,14 @@ import ( ) type Version struct { - Date string + Date string + TagDate string } +const ( + tagTimeStampFormat = "2006.01.02-MST" +) + func writeVersion(version Version) error { var versionTemplate = `// -------- DO NOT EDIT -------- // this is an autogenerated file @@ -46,6 +51,7 @@ import ( // Version autogenerated var Version = {{if .Date}}"{{.Date}}"{{else}}""{{end}} +var TagVersion = {{if .TagDate}}"{{.TagDate}}"{{else}}""{{end}} // getVersion - func getVersion() string { @@ -117,7 +123,10 @@ func runMcRelease(ctx *cli.Context) { if ctx.Args().First() == "help" { cli.ShowCommandHelpAndExit(ctx, "release", 1) // last argument is exit code } - version := Version{Date: time.Now().UTC().Format(time.RFC3339Nano)} + t := time.Now().UTC() + date := t.Format(time.RFC3339Nano) + tagDate := t.Format(tagTimeStampFormat) + version := Version{Date: date, TagDate: tagDate} err := writeVersion(version) if err != nil { fmt.Print(err)