1
1
package gocritic
2
2
3
3
import (
4
+ "maps"
4
5
"slices"
5
6
"strings"
6
7
"testing"
@@ -9,7 +10,6 @@ import (
9
10
gocriticlinter "github.com/go-critic/go-critic/linter"
10
11
"github.com/stretchr/testify/assert"
11
12
"github.com/stretchr/testify/require"
12
- "golang.org/x/exp/maps"
13
13
14
14
"github.com/golangci/golangci-lint/pkg/config"
15
15
"github.com/golangci/golangci-lint/pkg/logutils"
@@ -40,7 +40,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
40
40
t .Logf ("enabled by default checks:\n %s" , strings .Join (enabledByDefaultChecks , "\n " ))
41
41
42
42
insert := func (in []string , toInsert ... string ) []string {
43
- return append ( slices .Clone (in ) , toInsert ... )
43
+ return slices .Concat (in , toInsert )
44
44
}
45
45
46
46
remove := func (in []string , toRemove ... string ) []string {
@@ -54,9 +54,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
54
54
}
55
55
56
56
uniq := func (in []string ) []string {
57
- result := slices .Clone (in )
58
- slices .Sort (result )
59
- return slices .Compact (result )
57
+ return slices .Compact (slices .Sorted (slices .Values (in )))
60
58
}
61
59
62
60
cases := []struct {
@@ -269,7 +267,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
269
267
wr := newSettingsWrapper (tt .sett , lg )
270
268
271
269
wr .InferEnabledChecks ()
272
- assert .ElementsMatch (t , tt .expectedEnabledChecks , maps .Keys (wr .inferredEnabledChecks ))
270
+ assert .ElementsMatch (t , tt .expectedEnabledChecks , slices . Collect ( maps .Keys (wr .inferredEnabledChecks ) ))
273
271
assert .NoError (t , wr .Validate ())
274
272
})
275
273
}
0 commit comments