diff --git a/.gitignore b/.gitignore index fda534b..b0f46a2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.dylib ./FLEcli test/output/temp/* +./dist/* # Test binary, built with `go test -c` *.test diff --git a/.goreleaser.yml b/.goreleaser.yml index 73f2eb3..946ffbe 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,7 +3,7 @@ before: hooks: # Update the version so that it is included in the app - - ./update-version.sh + #- ./update-version.sh builds: - goos: - linux @@ -14,6 +14,8 @@ builds: goarch: 386 - goos: windows goarch: amd64 + ldflags: + - -s -w -X "FLEcli/cmd.VersionString={{.Version}} ({{.ShortCommit}})" env: - CGO_ENABLED=0 archives: diff --git a/FLEcli b/FLEcli new file mode 100755 index 0000000..c9beac7 Binary files /dev/null and b/FLEcli differ diff --git a/cmd/FLEcli_version.go b/cmd/FLEcli_version.go deleted file mode 100644 index 009baab..0000000 --- a/cmd/FLEcli_version.go +++ /dev/null @@ -1,4 +0,0 @@ -package cmd - -//VersionString is the version that will be displayed with the -v switch -const VersionString = "v0.0.0-1-gb4c7401 (2020-07-18)" diff --git a/cmd/root.go b/cmd/root.go index 3927763..e3468a0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -35,6 +35,7 @@ import ( var cfgFile string var inputFilename string var isInterpolateTime bool +var VersionString string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ diff --git a/update-version.sh b/update-version.sh deleted file mode 100755 index 6b57731..0000000 --- a/update-version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e - -VERSION_FROM_GIT=$(git describe --tags) -BUILD_TIME=$(date +%F) - -echo "Building version ${VERSION_FROM_GIT}" - -echo "package cmd" > cmd/FLEcli_version.go -echo " " >> cmd/FLEcli_version.go -echo "//VersionString is the version that will be displayed with the -v switch" >> cmd/FLEcli_version.go -echo "const VersionString = \"${VERSION_FROM_GIT} (${BUILD_TIME})\"" >> cmd/FLEcli_version.go