Merge pull request #811 from harshavardhana/pr_out_add_tag_date_with_make_go_formatted_with_git_check_format_ref_standards
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user