From 41171304b2c372e1bb07481a0e2e02515e19bb2c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 18 Aug 2018 17:10:27 +1000 Subject: [PATCH] add platform/os details to goreleaser ldflags --- .goreleaser.yml | 3 +++ main.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index a7b2bcfdb..c53044759 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,6 +13,9 @@ builds: - arm - arm64 - 386 + ldflags: + - -s -w -X main.version={{.Version}} -X main.tag={{.Tag}} -X main.date={{.Date}} -X main.commit={{.Commit}} -X "main.goos={{.Os}} -X "main.arch={{.Arch}} -X "main.arm={{.Arm}}" + archive: replacements: darwin: Darwin diff --git a/main.go b/main.go index 85e0f36bb..b2dc4ee42 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,9 @@ var ( commit string version = "unversioned" date string + goos string + arch string + arm string debuggingFlag = flag.Bool("debug", false, "a boolean") versionFlag = flag.Bool("v", false, "Print the current version") @@ -43,7 +46,7 @@ func main() { version = fallbackVersion() } if *versionFlag { - fmt.Printf("commit=%s, build date=%s, version=%s\n", commit, date, version) + fmt.Printf("commit=%s, build date=%s, version=%s, os=%s, arch=%s, arm=%s\n", commit, date, version, goos, arch, arm) os.Exit(0) } appConfig, err := config.NewAppConfig("lazygit", version, commit, date, debuggingFlag)