DRY ldflags; include build time into version string (#541)

This commit is contained in:
Dan Sosedoff
2021-12-30 15:33:43 -06:00
committed by GitHub
parent 706caa44bf
commit af79994595
2 changed files with 16 additions and 8 deletions

View File

@@ -161,12 +161,19 @@ func initOptions() {
func printVersion() {
chunks := []string{fmt.Sprintf("Pgweb v%s", command.Version)}
if command.GitCommit != "" {
chunks = append(chunks, fmt.Sprintf("(git: %s)", command.GitCommit))
}
if command.GoVersion != "" {
chunks = append(chunks, fmt.Sprintf("(go: %s)", command.GoVersion))
}
if command.BuildTime != "" {
chunks = append(chunks, fmt.Sprintf("(build time: %s)", command.BuildTime))
}
fmt.Println(strings.Join(chunks, " "))
}