Skip to content

Commit

Permalink
Merge pull request #31 from life4/fix-golangci-lint
Browse files Browse the repository at this point in the history
Fix new golangci-lint violations
  • Loading branch information
orsinium authored Nov 14, 2023
2 parents a795688 + 94a379e commit 6bf6cd6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions channels/channel_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ func WithContext[T any](c <-chan T, ctx context.Context) chan T {
select {
case result <- val:
case <-ctx.Done():
return
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion maps/maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package maps_test

import (
"fmt"
"strconv"
"testing"

"github.com/life4/genesis/maps"
Expand Down Expand Up @@ -77,7 +78,7 @@ func TestMap(t *testing.T) {
is := is.New(t)
m := map[int32]int64{1: 2, 3: 4, 5: 6}
f := func(k int32, v int64) (int, string) {
return int(k + 1), fmt.Sprintf("%d", v)
return int(k + 1), strconv.FormatInt(v, 10)
}
is.Equal(maps.Map(m, f), map[int]string{2: "2", 4: "4", 6: "6"})
}
Expand Down
3 changes: 2 additions & 1 deletion slices/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package slices_test
import (
"errors"
"fmt"
"strconv"

"github.com/life4/genesis/channels"
"github.com/life4/genesis/slices"
Expand Down Expand Up @@ -390,7 +391,7 @@ func ExampleMapFilter() {
s := []int{4, 8, 15, 16, 23, 42}
isEven := func(t int) (string, bool) {
if t%2 == 0 {
s := fmt.Sprintf("%d", t)
s := strconv.Itoa(t)
return s, true
} else {
return "", false
Expand Down
4 changes: 2 additions & 2 deletions slices/slice_func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package slices_test

import (
"errors"
"fmt"
"strconv"
"testing"

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

0 comments on commit 6bf6cd6

Please sign in to comment.