diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index d78564a67..54fbd65a3 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -38,6 +38,8 @@ const ( ) var ( + // buildDate allows vendor-specified build date when .git/ is unavailable. + buildDate string // vendorInfo contains vendor notes about the current build. vendorInfo string ) diff --git a/common/hugo/version.go b/common/hugo/version.go index edcb983d7..3bb6472e2 100644 --- a/common/hugo/version.go +++ b/common/hugo/version.go @@ -153,6 +153,10 @@ func BuildVersionString() string { osArch := bi.GoOS + "/" + bi.GoArch date := bi.RevisionTime + if date == "" { + // Accept vendor-specified build date if .git/ is unavailable. + date = buildDate + } if date == "" { date = "unknown" }