diff --git a/mage/main.go b/mage/main.go index b51ea95..de95078 100644 --- a/mage/main.go +++ b/mage/main.go @@ -72,6 +72,9 @@ const ( var debug = log.New(io.Discard, "DEBUG: ", log.Ltime|log.Lmicroseconds) +// distro* are optional -X ldflags for packaging builds without VCS metadata. +var distroTimestamp, distroCommit, distroGitTag string + //go:generate stringer -type=Command // Command tracks invocations of mage that run without targets or other flags. @@ -202,6 +205,15 @@ func doVersion(out *log.Logger) { } } } + if distroGitTag != "" { + gitTag = distroGitTag + } + if distroCommit != "" { + commitHash = distroCommit + } + if distroTimestamp != "" { + timestamp = distroTimestamp + } out.Println("Mage Build Tool", gitTag) out.Println("Build Date:", timestamp) out.Println("Commit:", commitHash)