Consolidate version location
This commit is contained in:
parent
eee330aea5
commit
a4987f4f42
@ -13,8 +13,6 @@ import (
|
|||||||
"mcquay.me/metrics"
|
"mcquay.me/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "v0.1.1"
|
|
||||||
|
|
||||||
type v struct {
|
type v struct {
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
V string `json:"version"`
|
V string `json:"version"`
|
||||||
@ -33,7 +31,7 @@ func main() {
|
|||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
r := v{
|
r := v{
|
||||||
Hostname: hn,
|
Hostname: hn,
|
||||||
V: version,
|
V: hw.Version,
|
||||||
}
|
}
|
||||||
if err := json.NewEncoder(w).Encode(r); err != nil {
|
if err := json.NewEncoder(w).Encode(r); err != nil {
|
||||||
log.Printf("json: %+v", err)
|
log.Printf("json: %+v", err)
|
||||||
|
@ -15,8 +15,6 @@ import (
|
|||||||
"mcquay.me/metrics"
|
"mcquay.me/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "v0.1.1"
|
|
||||||
|
|
||||||
var success *prometheus.CounterVec
|
var success *prometheus.CounterVec
|
||||||
|
|
||||||
type v struct {
|
type v struct {
|
||||||
@ -90,7 +88,7 @@ func main() {
|
|||||||
|
|
||||||
fetcher := state{
|
fetcher := state{
|
||||||
Hostname: hn,
|
Hostname: hn,
|
||||||
V: version,
|
V: hw.Version,
|
||||||
Counts: map[string]int{},
|
Counts: map[string]int{},
|
||||||
}
|
}
|
||||||
go fetcher.update(target)
|
go fetcher.update(target)
|
||||||
|
@ -3,13 +3,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
)
|
|
||||||
|
|
||||||
const version = "v0.1.1"
|
"mcquay.me/hw"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
for {
|
for {
|
||||||
log.Printf("hwl@%+v", version)
|
log.Printf("hwl@%+v", hw.Version)
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user