From 92c9511b1b286fe684e262469298d6118f3d98b0 Mon Sep 17 00:00:00 2001 From: Ben Schinn Date: Wed, 26 Aug 2020 11:38:20 -0600 Subject: [PATCH 1/2] added version flag --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index bcf56d2..ff7a695 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,8 @@ package main import ( "encoding/json" + "flag" + "fmt" "log" "net/http" @@ -78,6 +80,14 @@ func (hc *HealthCheckWebService) apiGetIsReplica(w http.ResponseWriter, r *http. } func main() { + versionPtr := flag.Bool("version", false, "Print the teecp version and exit.") + flag.Parse() + + if *versionPtr { + fmt.Println("1.0.0") + return + } + cfg, err := config.ParseConfig("./examples/config.yml") if err != nil { panic(err) From 26c3de49b7e5a3d6af8916fba070ea406967b93d Mon Sep 17 00:00:00 2001 From: Ben Schinn Date: Wed, 26 Aug 2020 12:36:34 -0600 Subject: [PATCH 2/2] closed string and fmtted --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 1b76ab8..f1555e2 100644 --- a/main.go +++ b/main.go @@ -2,9 +2,9 @@ package main import ( "encoding/json" + "errors" "flag" "fmt" - "errors "log" "net/http" "os"