Skip to content

Commit

Permalink
Replace sort.Strings with slices.Sort (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie authored Oct 22, 2024
1 parent a6a5e36 commit 32186af
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions clients/databricks/dialect/dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dialect

import (
"fmt"
"sort"
"slices"
"strings"
"testing"

Expand Down Expand Up @@ -135,7 +135,7 @@ func buildColumns(colTypesMap map[string]typing.KindDetails) *columns.Columns {
colNames = append(colNames, colName)
}
// Sort the column names alphabetically to ensure deterministic order
sort.Strings(colNames)
slices.Sort(colNames)

var cols columns.Columns
for _, colName := range colNames {
Expand Down
4 changes: 2 additions & 2 deletions clients/snowflake/dialect/dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dialect

import (
"fmt"
"sort"
"slices"
"testing"

"github.com/artie-labs/transfer/lib/config/constants"
Expand Down Expand Up @@ -277,7 +277,7 @@ func buildColumns(colTypesMap map[string]typing.KindDetails) *columns.Columns {
colNames = append(colNames, colName)
}
// Sort the column names alphabetically to ensure deterministic order
sort.Strings(colNames)
slices.Sort(colNames)

var cols columns.Columns
for _, colName := range colNames {
Expand Down
4 changes: 2 additions & 2 deletions lib/destination/types/table_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package types_test

import (
"math/rand"
"sort"
"slices"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestAuditColumnsToDelete(t *testing.T) {
actualCols = []string{}
}

sort.Strings(actualCols)
slices.Sort(actualCols)
assert.Equal(t, tc.expectedColsRemain, actualCols, idx)
}
}
6 changes: 3 additions & 3 deletions lib/optimization/table_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package optimization

import (
"fmt"
"sort"
"slices"
"testing"
"time"

Expand Down Expand Up @@ -98,8 +98,8 @@ func slicesEqualUnordered(s1, s2 []string) bool {
return false
}

sort.Strings(s1)
sort.Strings(s2)
slices.Sort(s1)
slices.Sort(s2)

for i, v := range s1 {
if v != s2[i] {
Expand Down
4 changes: 2 additions & 2 deletions models/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"cmp"
"fmt"
"log/slog"
"sort"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -153,7 +153,7 @@ func (e *Event) PrimaryKeys() []string {
keys = append(keys, key)
}

sort.Strings(keys)
slices.Sort(keys)
return keys
}

Expand Down

0 comments on commit 32186af

Please sign in to comment.