show build info

This commit is contained in:
Timon Ringwald 2022-08-29 10:50:38 +02:00
parent f91780d6ce
commit c964a85673
1 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,8 @@ func WorkTreeChanged() bool {
}
func GatherMetaData() {
BuildTime = time.Now().Format(time.RFC3339)
if !WorkTreeChanged() {
VersionTag, _ = GetVersionTag()
CommitHash, _ = GetCommitHash("%H")
@ -103,7 +105,15 @@ func GatherMetaData() {
VersionTag = fmt.Sprintf("(devel-%s)", hash)
}
BuildTime = time.Now().Format(time.RFC3339)
if !*Silent {
ColorDone.Println("build info:")
fmt.Printf("version: %s\n", VersionTag)
fmt.Printf("build time: %s\n", BuildTime)
if CommitHash != "" {
fmt.Printf("commit hash: %s\n", CommitHash)
}
fmt.Println()
}
}
func BuildLdFlags(os, arch string) string {