Skip to content

Commit

Permalink
Use stdlib slices
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcdawkins committed Jun 25, 2024
1 parent 5f8e5d2 commit 4a939d2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -46,6 +45,7 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
Expand Down
3 changes: 1 addition & 2 deletions internal/question/build_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"fmt"
"path"
"path/filepath"

"golang.org/x/exp/slices"
"slices"

"github.com/platformsh/platformify/internal/question/models"
"github.com/platformsh/platformify/internal/utils"
Expand Down
3 changes: 1 addition & 2 deletions internal/question/deploy_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"fmt"
"path"
"path/filepath"

"golang.org/x/exp/slices"
"slices"

"github.com/platformsh/platformify/internal/question/models"
"github.com/platformsh/platformify/internal/utils"
Expand Down
3 changes: 1 addition & 2 deletions internal/question/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"context"
"fmt"
"os"
"slices"
"strings"

"golang.org/x/exp/slices"

"github.com/AlecAivazis/survey/v2"

"github.com/platformsh/platformify/internal/colors"
Expand Down
3 changes: 1 addition & 2 deletions internal/question/web_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (
"os"
"path"
"path/filepath"
"slices"
"strings"

"golang.org/x/exp/slices"

"github.com/platformsh/platformify/internal/question/models"
"github.com/platformsh/platformify/internal/utils"
"github.com/platformsh/platformify/vendorization"
Expand Down
7 changes: 4 additions & 3 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package utils
import (
"bufio"
"bytes"
"cmp"
"encoding/json"
"io"
"os"
"path/filepath"
"slices"
"strings"

"github.com/pelletier/go-toml/v2"
"golang.org/x/exp/slices"
)

var skipDirs = []string{
Expand All @@ -34,8 +35,8 @@ func FindFile(searchPath, name string) string {
return ""
}

slices.SortFunc(files, func(a, b string) bool {
return len(strings.Split(a, string(os.PathSeparator))) < len(strings.Split(b, string(os.PathSeparator)))
slices.SortFunc(files, func(a, b string) int {
return cmp.Compare(strings.Count(a, string(os.PathSeparator)), strings.Count(b, string(os.PathSeparator)))
})
return files[0]
}
Expand Down
3 changes: 1 addition & 2 deletions platformifier/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"os"
"path"
"path/filepath"
"slices"
"strings"

"golang.org/x/exp/slices"
)

var skipDirs = []string{
Expand Down
2 changes: 1 addition & 1 deletion validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"io/fs"
"os"
"path/filepath"
"slices"

"github.com/xeipuuv/gojsonschema"
"golang.org/x/exp/slices"
"gopkg.in/yaml.v3"

"github.com/platformsh/platformify/internal/utils"
Expand Down

0 comments on commit 4a939d2

Please sign in to comment.