From b9bb5e8f5eb4de4a87ca31e6cf80c8d0c87a06a4 Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Sat, 11 Jul 2020 14:32:53 +0200 Subject: [PATCH] Add version display and multiarch build --- .gitignore | 1 + cmd/inferTime.go | 2 +- cmd/root.go | 10 +--------- cmd/version2.go | 4 ++++ full_build.sh | 16 ++++++++++++++++ go.mod | 3 +-- 6 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 cmd/version2.go create mode 100755 full_build.sh diff --git a/.gitignore b/.gitignore index 55f22c2..caf9d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.so *.dylib FLEcli +executables/* # Test binary, built with `go test -c` *.test diff --git a/cmd/inferTime.go b/cmd/inferTime.go index f7595c4..a8d5f0a 100644 --- a/cmd/inferTime.go +++ b/cmd/inferTime.go @@ -103,7 +103,7 @@ func (tb *InferTimeBlock) storeTimeGap(logline LogLine, position int) (bool, err tb.logFilePosition = position } else { // We reached the end of the gap - if tb.lastRecordedTime.IsZero(){ + if tb.lastRecordedTime.IsZero() { return false, errors.New("Gap start time is empty") } if tb.nextValidTime, err = time.Parse(ADIFdateTimeFormat, logline.Date+" "+logline.ActualTime); err != nil { diff --git a/cmd/root.go b/cmd/root.go index d42cb5d..3927763 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -41,15 +41,7 @@ var rootCmd = &cobra.Command{ Use: "FLEcli", Short: "A Command Line \"Fast Log Entry\" (FLE) processor", TraverseChildren: true, - // Long: `A longer description that spans multiple lines and likely contains - // examples and usage of using your application. For example: - - // Cobra is a CLI library for Go that empowers applications. - // This application is a tool to generate the needed files - // to quickly create a Cobra application.`, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, + Version: VersionString, } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/cmd/version2.go b/cmd/version2.go new file mode 100644 index 0000000..710fa8b --- /dev/null +++ b/cmd/version2.go @@ -0,0 +1,4 @@ +package cmd + +const VersionString = "v0.0.0 2020-07-11" + diff --git a/full_build.sh b/full_build.sh new file mode 100755 index 0000000..4c1f654 --- /dev/null +++ b/full_build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +go test ./... + +mkdir -p executables/windows +mkdir -p executables/macos +mkdir -p executables/linux + +#Update version + +GOOS=windows GOARCH=386 go build -o executables/windows/FLEcli.exe +GOOS=darwin GOARCH=amd64 go build -o executables/macos/FLEcli +GOOS=linux GOARCH=amd64 go build -o executables/linux/FLEcli-amd64 + diff --git a/go.mod b/go.mod index a1111ea..0c76514 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.7.0 - golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect - golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc + golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect gopkg.in/ini.v1 v1.57.0 // indirect )