From a4987f4f4232dd480d0610325b531cb5b8d8382f Mon Sep 17 00:00:00 2001 From: "Stephen McQuay (smcquay)" Date: Thu, 8 Mar 2018 14:48:25 -0800 Subject: [PATCH] Consolidate version location --- cmd/hw/main.go | 4 +--- cmd/hwc/main.go | 4 +--- cmd/hwl/main.go | 6 +++--- hw.go | 2 ++ 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/hw/main.go b/cmd/hw/main.go index 6398684..e6de592 100644 --- a/cmd/hw/main.go +++ b/cmd/hw/main.go @@ -13,8 +13,6 @@ import ( "mcquay.me/metrics" ) -const version = "v0.1.1" - type v struct { Hostname string `json:"hostname"` V string `json:"version"` @@ -33,7 +31,7 @@ func main() { w.Header().Set("Content-Type", "application/json") r := v{ Hostname: hn, - V: version, + V: hw.Version, } if err := json.NewEncoder(w).Encode(r); err != nil { log.Printf("json: %+v", err) diff --git a/cmd/hwc/main.go b/cmd/hwc/main.go index 68e5a7a..38a141e 100644 --- a/cmd/hwc/main.go +++ b/cmd/hwc/main.go @@ -15,8 +15,6 @@ import ( "mcquay.me/metrics" ) -const version = "v0.1.1" - var success *prometheus.CounterVec type v struct { @@ -90,7 +88,7 @@ func main() { fetcher := state{ Hostname: hn, - V: version, + V: hw.Version, Counts: map[string]int{}, } go fetcher.update(target) diff --git a/cmd/hwl/main.go b/cmd/hwl/main.go index 22253be..f769749 100644 --- a/cmd/hwl/main.go +++ b/cmd/hwl/main.go @@ -3,13 +3,13 @@ package main import ( "log" "time" -) -const version = "v0.1.1" + "mcquay.me/hw" +) func main() { for { - log.Printf("hwl@%+v", version) + log.Printf("hwl@%+v", hw.Version) time.Sleep(1 * time.Second) } } diff --git a/hw.go b/hw.go index de991e1..d325d8d 100644 --- a/hw.go +++ b/hw.go @@ -2,5 +2,7 @@ package hw import "net/http" +const Version = "v0.1.2" + // OK simply return 200 func OK(w http.ResponseWriter, req *http.Request) {}