Skip to content

Commit

Permalink
chore(lint): linting fixes for gosimple (#1773)
Browse files Browse the repository at this point in the history
  • Loading branch information
thevilledev authored Aug 10, 2023
1 parent 15b89c9 commit 1842bef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
7 changes: 2 additions & 5 deletions config/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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..
Expand Down
6 changes: 2 additions & 4 deletions manager/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions manager/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand All @@ -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())
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion watch/dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 1842bef

Please sign in to comment.