diff --git a/.goreleaser.yml b/.goreleaser.yml index 2cc5dc0..e07bbf7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,7 +7,7 @@ builds: binary: amtui env: - CGO_ENABLED=0 - ldflags: -s -w -X pkg.versionString={{.Tag}} + ldflags: -s -w -X github.com/pehlicd/amtui/pkg.versionString={{ .Tag }} -X github.com/pehlicd/amtui/pkg.buildDate={{ .Date }} -X github.com/pehlicd/amtui/pkg.buildCommit={{ .Commit }} goos: - linux - darwin diff --git a/pkg/config.go b/pkg/config.go index 72bfa98..0b3bf7e 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -23,14 +23,14 @@ Options: ) var ( - versionString string - fl = flag.NewFlagSet("amtui", flag.ExitOnError) - host = fl.String("host", "localhost", "Alertmanager host") - port = fl.StringP("port", "p", "9093", "Alertmanager port") - insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager") - help = fl.BoolP("help", "h", false, "Show help") - version = fl.BoolP("version", "v", false, "Show version") - scheme = "http" + versionString, buildDate, buildCommit string + fl = flag.NewFlagSet("amtui", flag.ExitOnError) + host = fl.String("host", "localhost", "Alertmanager host") + port = fl.StringP("port", "p", "9093", "Alertmanager port") + insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager") + help = fl.BoolP("help", "h", false, "Show help") + version = fl.BoolP("version", "v", false, "Show version") + scheme = "http" ) func printHelp(w io.Writer) { @@ -75,7 +75,7 @@ func initConfig() Config { } if *version { - fmt.Printf("amtui version: v%s\n", versionString) + fmt.Printf("Version: %s\nBuild Date: %s\nBuild Commit: %s\n", versionString, buildDate, buildCommit) os.Exit(0) }