http.go: Move helper function nowSeries() to test case

Fixes:
http.go:142:1⚠️ nowSeries is unused (deadcode)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
This commit is contained in:
Karsten Weiss 2018-04-13 22:49:34 +02:00
parent 0a453dce84
commit f3a13af35c
2 changed files with 10 additions and 10 deletions

View File

@ -139,16 +139,6 @@ var now nower = nowFunc(func() time.Time {
return time.Now() return time.Now()
}) })
func nowSeries(t ...time.Time) nower {
return nowFunc(func() time.Time {
defer func() {
t = t[1:]
}()
return t[0]
})
}
// InstrumentHandler wraps the given HTTP handler for instrumentation. It // InstrumentHandler wraps the given HTTP handler for instrumentation. It
// registers four metric collectors (if not already done) and reports HTTP // registers four metric collectors (if not already done) and reports HTTP
// metrics to the (newly or already) registered collectors: http_requests_total // metrics to the (newly or already) registered collectors: http_requests_total

View File

@ -29,6 +29,16 @@ func (b respBody) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(b)) w.Write([]byte(b))
} }
func nowSeries(t ...time.Time) nower {
return nowFunc(func() time.Time {
defer func() {
t = t[1:]
}()
return t[0]
})
}
func TestInstrumentHandler(t *testing.T) { func TestInstrumentHandler(t *testing.T) {
defer func(n nower) { defer func(n nower) {
now = n.(nower) now = n.(nower)