From e035b26e30d2c25a51347130ac8e9770894052a8 Mon Sep 17 00:00:00 2001 From: Bob Shannon Date: Tue, 10 Apr 2018 18:37:17 -0700 Subject: [PATCH] Bump go version used in build Signed-off-by: Bob Shannon --- .travis.yml | 5 ++--- api/prometheus/v1/api.go | 9 ++------- api/prometheus/v1/api_test.go | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index e9bca4e..1d18e98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,8 @@ sudo: false language: go go: - - 1.7.x - - 1.8.x - - 1.9.x + - 1.10.x + - 1.x script: - go test -short ./... diff --git a/api/prometheus/v1/api.go b/api/prometheus/v1/api.go index 3fc58d8..5261dc6 100644 --- a/api/prometheus/v1/api.go +++ b/api/prometheus/v1/api.go @@ -20,7 +20,6 @@ package v1 import ( "context" "encoding/json" - "errors" "fmt" "net/http" "net/url" @@ -147,7 +146,7 @@ type ActiveTarget struct { DiscoveredLabels model.LabelSet `json:"discoveredLabels"` Labels model.LabelSet `json:"labels"` ScrapeURL *url.URL `json:"scrapeUrl"` - LastError error `json:"lastError"` + LastError string `json:"lastError"` LastScrape time.Time `json:"lastScrape"` Health scrape.TargetHealth `json:"health"` } @@ -188,11 +187,7 @@ func (a *ActiveTarget) UnmarshalJSON(b []byte) error { a.ScrapeURL = url a.LastScrape = v.LastScrape a.Health = v.Health - if v.LastError != "" { - a.LastError = errors.New(v.LastError) - } else { - a.LastError = nil - } + a.LastError = v.LastError return err } diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index 7a42e17..29a2910 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -18,7 +18,6 @@ package v1 import ( "context" "encoding/json" - "errors" "fmt" "net/http" "net/url" @@ -477,7 +476,7 @@ func TestAPIs(t *testing.T) { "job": "prometheus", }, ScrapeURL: testURL, - LastError: errors.New("error while scraping target"), + LastError: "error while scraping target", LastScrape: testTime.Round(0), Health: scrape.HealthGood, },