Skip to content

Commit

Permalink
chore: add hash commit and date for release
Browse files Browse the repository at this point in the history
  • Loading branch information
r3inbowari committed May 16, 2024
1 parent 34a7234 commit b38d82a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
9 changes: 7 additions & 2 deletions speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
}
}

0 comments on commit b38d82a

Please sign in to comment.