diff --git a/config/convert.go b/config/convert.go index afc62451b..bd1877cd2 100644 --- a/config/convert.go +++ b/config/convert.go @@ -36,10 +36,7 @@ func BoolGoString(b *bool) string { // BoolPresent returns a boolean indicating if the pointer is nil, or if the // pointer is pointing to the zero value.. func BoolPresent(b *bool) bool { - if b == nil { - return false - } - return true + return b != nil } // FileMode returns a pointer to the given os.FileMode. @@ -201,7 +198,7 @@ func TimeDurationGoString(t *time.Duration) string { if t == nil { return "(*time.Duration)(nil)" } - return fmt.Sprintf("%s", t) + return t.String() } // TimeDurationPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value.. diff --git a/manager/runner.go b/manager/runner.go index 9f330b349..cef90504f 100644 --- a/manager/runner.go +++ b/manager/runner.go @@ -1280,10 +1280,8 @@ func (q *quiescence) tick() { if q.timer == nil { q.timer = time.NewTimer(q.min) go func() { - select { - case <-q.timer.C: - q.ch <- q.template - } + <-q.timer.C + q.ch <- q.template }() q.deadline = now.Add(q.max) diff --git a/manager/runner_test.go b/manager/runner_test.go index f10fe6722..7ba249a3d 100644 --- a/manager/runner_test.go +++ b/manager/runner_test.go @@ -1046,7 +1046,7 @@ func TestRunner_quiescence(t *testing.T) { q.tick() select { case <-ch: - dur := time.Now().Sub(start) + dur := time.Since(start) if dur < q.min || dur > 2*q.min { t.Fatalf("bad duration %9.6f", dur.Seconds()) } @@ -1072,7 +1072,7 @@ func TestRunner_quiescence(t *testing.T) { q.tick() select { case <-ch: - dur := time.Now().Sub(start) + dur := time.Since(start) if dur < q.min || dur > 2*q.min { t.Fatalf("bad duration %9.6f", dur.Seconds()) } @@ -1092,7 +1092,7 @@ func TestRunner_quiescence(t *testing.T) { // cut off at the max time. fired := false start := time.Now() - for !fired && time.Now().Sub(start) < 2*q.max { + for !fired && time.Since(start) < 2*q.max { q.tick() time.Sleep(q.min / 2) select { diff --git a/watch/dependencies_test.go b/watch/dependencies_test.go index 48bb437e5..9bc78daae 100644 --- a/watch/dependencies_test.go +++ b/watch/dependencies_test.go @@ -172,5 +172,5 @@ func (d *TestDepBlock) Fetch(clients *dep.ClientSet, opts *dep.QueryOptions) (in } func (d *TestDepBlock) String() string { - return fmt.Sprintf("test_dep_block") + return "test_dep_block" }