Skip to content

Commit

Permalink
dev: replace sliceutil package with exp/slices
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed May 11, 2023
1 parent 4af546a commit a791da1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 48 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
"golang.org/x/exp/slices"

"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/fsutils"
"github.com/golangci/golangci-lint/pkg/logutils"
"github.com/golangci/golangci-lint/pkg/sliceutil"
)

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

Expand Down
17 changes: 0 additions & 17 deletions pkg/sliceutil/sliceutil.go

This file was deleted.

17 changes: 0 additions & 17 deletions pkg/sliceutil/sliceutil_test.go

This file was deleted.

14 changes: 3 additions & 11 deletions test/enabled_linters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strings"
"testing"

"golang.org/x/exp/slices"

"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
"github.com/golangci/golangci-lint/test/testshared"
)
Expand Down Expand Up @@ -134,16 +136,6 @@ func TestEnabledLinters(t *testing.T) {
}
}

func inSlice(s []string, v string) bool {
for _, sv := range s {
if sv == v {
return true
}
}

return false
}

func getEnabledByDefaultFastLintersExcept(except ...string) []string {
m := lintersdb.NewManager(nil, nil)
ebdl := m.GetAllEnabledByDefaultLinters()
Expand All @@ -153,7 +145,7 @@ func getEnabledByDefaultFastLintersExcept(except ...string) []string {
continue
}

if !inSlice(except, lc.Name()) {
if !slices.Contains(except, lc.Name()) {
ret = append(ret, lc.Name())
}
}
Expand Down

0 comments on commit a791da1

Please sign in to comment.