From 778cb14dc48d24764b86d2a7e9ac3a7ddb4121a6 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 22:48:37 +1000 Subject: update to use goreleaser ldflags --- .goreleaser.yml | 14 ++++++++++++-- main.go | 11 ++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 41c2806ed..27aaf3638 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,8 +1,18 @@ # This is an example goreleaser.yaml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com builds: -- env: - - CGO_ENABLED=0 + env: + - CGO_ENABLED=0 + main: ./main.go + goos: + - freebsd + - windows + - darwin + - linux + goarch: + - amd64 + - arm + - arm64 archive: replacements: darwin: Darwin diff --git a/main.go b/main.go index ad753c407..dcffbd835 100644 --- a/main.go +++ b/main.go @@ -20,13 +20,10 @@ var ( subprocess *exec.Cmd startTime time.Time - // Rev - Git Revision - Rev string + commit string + version = "unversioned" - // Version - Version number - Version = "unversioned" - - builddate string + date string debuggingFlag = flag.Bool("debug", false, "a boolean") versionFlag = flag.Bool("v", false, "Print the current version") ) @@ -77,7 +74,7 @@ func main() { devLog("\n\n\n\n\n\n\n\n\n\n") flag.Parse() if *versionFlag { - fmt.Printf("rev=%s, build date=%s, version=%s", Rev, builddate, Version) + fmt.Printf("rev=%s, build date=%s, version=%s", Rev, date, Version) os.Exit(0) } verifyInGitRepo() -- cgit v1.2.3