Skip to content

Commit a791da1

Browse files
committed
dev: replace sliceutil package with exp/slices
1 parent 4af546a commit a791da1

File tree

5 files changed

+6
-48
lines changed

5 files changed

+6
-48
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ require (
182182
go.uber.org/atomic v1.7.0 // indirect
183183
go.uber.org/multierr v1.6.0 // indirect
184184
go.uber.org/zap v1.24.0 // indirect
185-
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
185+
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
186186
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
187187
golang.org/x/mod v0.10.0 // indirect
188188
golang.org/x/sync v0.1.0 // indirect

pkg/config/reader.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99

1010
"github.com/mitchellh/go-homedir"
1111
"github.com/spf13/viper"
12+
"golang.org/x/exp/slices"
1213

1314
"github.com/golangci/golangci-lint/pkg/exitcodes"
1415
"github.com/golangci/golangci-lint/pkg/fsutils"
1516
"github.com/golangci/golangci-lint/pkg/logutils"
16-
"github.com/golangci/golangci-lint/pkg/sliceutil"
1717
)
1818

1919
type FileReader struct {
@@ -203,7 +203,7 @@ func (r *FileReader) setupConfigFileSearch() {
203203
// find home directory for global config
204204
if home, err := homedir.Dir(); err != nil {
205205
r.log.Warnf("Can't get user's home directory: %s", err.Error())
206-
} else if !sliceutil.Contains(configSearchPaths, home) {
206+
} else if !slices.Contains(configSearchPaths, home) {
207207
configSearchPaths = append(configSearchPaths, home)
208208
}
209209

pkg/sliceutil/sliceutil.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

pkg/sliceutil/sliceutil_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/enabled_linters_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"strings"
77
"testing"
88

9+
"golang.org/x/exp/slices"
10+
911
"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
1012
"github.com/golangci/golangci-lint/test/testshared"
1113
)
@@ -134,16 +136,6 @@ func TestEnabledLinters(t *testing.T) {
134136
}
135137
}
136138

137-
func inSlice(s []string, v string) bool {
138-
for _, sv := range s {
139-
if sv == v {
140-
return true
141-
}
142-
}
143-
144-
return false
145-
}
146-
147139
func getEnabledByDefaultFastLintersExcept(except ...string) []string {
148140
m := lintersdb.NewManager(nil, nil)
149141
ebdl := m.GetAllEnabledByDefaultLinters()
@@ -153,7 +145,7 @@ func getEnabledByDefaultFastLintersExcept(except ...string) []string {
153145
continue
154146
}
155147

156-
if !inSlice(except, lc.Name()) {
148+
if !slices.Contains(except, lc.Name()) {
157149
ret = append(ret, lc.Name())
158150
}
159151
}

0 commit comments

Comments
 (0)