Accept vendor-specified build date if .git/ is unavailable

Fixes #10053
This commit is contained in:
Anthony Fok authored and Bjørn Erik Pedersen committed 2022-06-28 20:51:18 +02:00
1 parent 241481931f
commit 8ebcaa5394
2 files changed
+6

No files matched your search

+2
View File
@@ -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
)
+4
View File
@@ -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"
}