mirror of
https://github.com/samber/lo.git
synced 2026-04-22 15:37:14 +08:00
chore(linter): adding modernize linter (#841)
This commit is contained in:
@@ -37,6 +37,7 @@ linters:
|
||||
- tparallel
|
||||
- paralleltest
|
||||
- predeclared
|
||||
- modernize
|
||||
|
||||
# disable noisy/controversial ones which you might enable later
|
||||
disable:
|
||||
|
||||
@@ -143,7 +143,7 @@ func Assign[K comparable, V any, Map ~map[K]V](maps ...iter.Seq[Map]) Map {
|
||||
for i := range maps {
|
||||
for item := range maps[i] {
|
||||
for k, v := range item {
|
||||
out[k] = v
|
||||
out[k] = v //nolint:modernize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -730,7 +730,7 @@ func TestInterleave(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, slices.Collect(Interleave(tc.in...)))
|
||||
@@ -852,7 +852,7 @@ func TestAssociate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, Associate(slices.Values(tc.in), transform))
|
||||
@@ -884,7 +884,7 @@ func TestAssociateI(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, AssociateI(slices.Values(tc.in), transform))
|
||||
@@ -920,7 +920,7 @@ func TestSeqToMap(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, SeqToMap(slices.Values(tc.in), transform))
|
||||
@@ -952,7 +952,7 @@ func TestSeqToMapI(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, SeqToMapI(slices.Values(tc.in), transform))
|
||||
@@ -988,7 +988,7 @@ func TestFilterSeqToMap(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, FilterSeqToMap(slices.Values(tc.in), transform))
|
||||
@@ -1020,7 +1020,7 @@ func TestFilterSeqToMapI(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
tc := tc //nolint:modernize
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert.Equal(t, tc.want, FilterSeqToMapI(slices.Values(tc.in), transform))
|
||||
|
||||
+4
-4
@@ -241,8 +241,8 @@ func TestProductByErr(t *testing.T) {
|
||||
// Test normal operation (no error) - table driven
|
||||
tests := []struct {
|
||||
name string
|
||||
input interface{}
|
||||
expected interface{}
|
||||
input any
|
||||
expected any
|
||||
}{
|
||||
{
|
||||
name: "float32 slice",
|
||||
@@ -403,8 +403,8 @@ func TestMeanByErr(t *testing.T) {
|
||||
// Test normal operation (no error) - table driven
|
||||
tests := []struct {
|
||||
name string
|
||||
input interface{}
|
||||
expected interface{}
|
||||
input any
|
||||
expected any
|
||||
}{
|
||||
{
|
||||
name: "float32 slice",
|
||||
|
||||
Reference in New Issue
Block a user