Skip to content

Commit 94a379e

Browse files
committed
Fix new golangci-lint violations
1 parent a795688 commit 94a379e

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

channels/channel_ctx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ func WithContext[T any](c <-chan T, ctx context.Context) chan T {
612612
select {
613613
case result <- val:
614614
case <-ctx.Done():
615+
return
615616
}
616617
}
617618
}

maps/maps_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package maps_test
22

33
import (
44
"fmt"
5+
"strconv"
56
"testing"
67

78
"github.com/life4/genesis/maps"
@@ -77,7 +78,7 @@ func TestMap(t *testing.T) {
7778
is := is.New(t)
7879
m := map[int32]int64{1: 2, 3: 4, 5: 6}
7980
f := func(k int32, v int64) (int, string) {
80-
return int(k + 1), fmt.Sprintf("%d", v)
81+
return int(k + 1), strconv.FormatInt(v, 10)
8182
}
8283
is.Equal(maps.Map(m, f), map[int]string{2: "2", 4: "4", 6: "6"})
8384
}

slices/examples_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package slices_test
33
import (
44
"errors"
55
"fmt"
6+
"strconv"
67

78
"github.com/life4/genesis/channels"
89
"github.com/life4/genesis/slices"
@@ -390,7 +391,7 @@ func ExampleMapFilter() {
390391
s := []int{4, 8, 15, 16, 23, 42}
391392
isEven := func(t int) (string, bool) {
392393
if t%2 == 0 {
393-
s := fmt.Sprintf("%d", t)
394+
s := strconv.Itoa(t)
394395
return s, true
395396
} else {
396397
return "", false

slices/slice_func_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package slices_test
22

33
import (
44
"errors"
5-
"fmt"
5+
"strconv"
66
"testing"
77

88
"github.com/life4/genesis/slices"
@@ -278,7 +278,7 @@ func TestMapFilter(t *testing.T) {
278278
f := func(given []int, expected []string) {
279279
isEven := func(t int) (string, bool) {
280280
if t%2 == 0 {
281-
s := fmt.Sprintf("%d", t)
281+
s := strconv.Itoa(t)
282282
return s, true
283283
} else {
284284
return "", false

0 commit comments

Comments
 (0)