1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

fix(version): be explicit when VCS info is unavailable

This commit is contained in:
Frédéric Guillot 2025-08-16 12:13:30 -07:00
parent c1af510ead
commit a010544200

View file

@ -5,7 +5,6 @@ package version // import "miniflux.app/v2/internal/version"
import (
"runtime/debug"
"time"
)
// Variables populated at build time.
@ -19,11 +18,14 @@ func getCommit() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return setting.Value[:8] // Short commit hash
if len(setting.Value) >= 8 {
return setting.Value[:8]
}
return setting.Value
}
}
}
return "HEAD"
return "Unknown (built outside VCS)"
}
func getBuildDate() string {
@ -34,5 +36,5 @@ func getBuildDate() string {
}
}
}
return time.Now().Format(time.RFC3339)
return "Unknown (built outside VCS)"
}