--- ./magefile.go 2022-04-11 10:54:34.000000000 -0400 +++ ./magefile.go 2022-04-11 10:55:32.000000000 -0400 @@ -21,6 +21,8 @@ "github.com/magefile/mage/sh" ) +const Version = "@VERSION@" + var Aliases = map[string]interface{}{ "Speak": Say, } @@ -99,23 +101,5 @@ } func flags() string { - timestamp := time.Now().Format(time.RFC3339) - hash := hash() - tag := tag() - if tag == "" { - tag = "dev" - } - return fmt.Sprintf(`-X "github.com/magefile/mage/mage.timestamp=%s" -X "github.com/magefile/mage/mage.commitHash=%s" -X "github.com/magefile/mage/mage.gitTag=%s"`, timestamp, hash, tag) -} - -// tag returns the git tag for the current branch or "" if none. -func tag() string { - s, _ := sh.Output("git", "describe", "--tags") - return s -} - -// hash returns the git hash for the current repo or "" if none. -func hash() string { - hash, _ := sh.Output("git", "rev-parse", "--short", "HEAD") - return hash + return fmt.Sprintf(`-X "github.com/magefile/mage/mage.gitTag=%s"`, Version) }