24 lines
604 B
Go
24 lines
604 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
// Build metadata injected at build time via -ldflags -X (see Makefile). version
|
|
// is sourced from the VERSION file so a single file is the authoritative version;
|
|
// commit and date are filled from git and the build clock.
|
|
var (
|
|
version = "dev"
|
|
commit = ""
|
|
date = ""
|
|
)
|
|
|
|
// printVersion writes the version line plus commit and build date when those
|
|
// were injected at build time.
|
|
func printVersion() {
|
|
fmt.Println("drive-health-metrics", version)
|
|
if commit != "" {
|
|
fmt.Printf(" commit: %s\n", commit)
|
|
}
|
|
if date != "" {
|
|
fmt.Printf(" built: %s\n", date)
|
|
}
|
|
}
|