diff --git a/.goreleaser.yml b/.goreleaser.yml index 2e40459..71e3d1c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -36,6 +36,8 @@ builds: gomips: - hardfloat - softfloat + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }} archives: - name_template: >- {{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "openbsd" }}OpenBSD{{ else }}{{ title .Os }}{{ end }}_{{ if eq .Arch "386" }}i386{{ else if eq .Arch "amd64" }}x86_64{{ else }}{{ .Arch }}{{ end }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }} diff --git a/speedtest.go b/speedtest.go index 7cfa222..10a1b79 100644 --- a/speedtest.go +++ b/speedtest.go @@ -41,8 +41,13 @@ var ( debug = kingpin.Flag("debug", "Enable debug mode.").Short('d').Bool() ) +var ( + commit = "dev" + date = "unknown" +) + func main() { - kingpin.Version(speedtest.Version()) + kingpin.Version(fmt.Sprintf("speedtest-go v%s git-%s built at %s", speedtest.Version(), commit, date)) kingpin.Parse() AppInfo() @@ -313,7 +318,7 @@ func parseProto(str string) speedtest.Proto { func AppInfo() { if !*jsonOutput { fmt.Println() - fmt.Printf(" speedtest-go v%s @showwin\n", speedtest.Version()) + fmt.Printf(" speedtest-go v%s (git-%s) @showwin\n", speedtest.Version(), commit) fmt.Println() } }