mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Accept vendor-specified build date if .git/ is unavailable
Fixes #10053
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
241481931f
commit
8ebcaa5394
@@ -38,6 +38,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// buildDate allows vendor-specified build date when .git/ is unavailable.
|
||||||
|
buildDate string
|
||||||
// vendorInfo contains vendor notes about the current build.
|
// vendorInfo contains vendor notes about the current build.
|
||||||
vendorInfo string
|
vendorInfo string
|
||||||
)
|
)
|
||||||
|
@@ -153,6 +153,10 @@ func BuildVersionString() string {
|
|||||||
osArch := bi.GoOS + "/" + bi.GoArch
|
osArch := bi.GoOS + "/" + bi.GoArch
|
||||||
|
|
||||||
date := bi.RevisionTime
|
date := bi.RevisionTime
|
||||||
|
if date == "" {
|
||||||
|
// Accept vendor-specified build date if .git/ is unavailable.
|
||||||
|
date = buildDate
|
||||||
|
}
|
||||||
if date == "" {
|
if date == "" {
|
||||||
date = "unknown"
|
date = "unknown"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user