From 32186af325f0e8a89f9a7646b41bace174ad8d70 Mon Sep 17 00:00:00 2001 From: Nathan <148575555+nathan-artie@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:44:34 -0700 Subject: [PATCH] Replace `sort.Strings` with `slices.Sort` (#974) --- clients/databricks/dialect/dialect_test.go | 4 ++-- clients/snowflake/dialect/dialect_test.go | 4 ++-- lib/destination/types/table_config_test.go | 4 ++-- lib/optimization/table_data_test.go | 6 +++--- models/event/event.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clients/databricks/dialect/dialect_test.go b/clients/databricks/dialect/dialect_test.go index 948724e54..6cb6a5b84 100644 --- a/clients/databricks/dialect/dialect_test.go +++ b/clients/databricks/dialect/dialect_test.go @@ -2,7 +2,7 @@ package dialect import ( "fmt" - "sort" + "slices" "strings" "testing" @@ -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 { diff --git a/clients/snowflake/dialect/dialect_test.go b/clients/snowflake/dialect/dialect_test.go index d377aaf5a..fbf3ce19d 100644 --- a/clients/snowflake/dialect/dialect_test.go +++ b/clients/snowflake/dialect/dialect_test.go @@ -2,7 +2,7 @@ package dialect import ( "fmt" - "sort" + "slices" "testing" "github.com/artie-labs/transfer/lib/config/constants" @@ -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 { diff --git a/lib/destination/types/table_config_test.go b/lib/destination/types/table_config_test.go index 9e572083b..00562d74e 100644 --- a/lib/destination/types/table_config_test.go +++ b/lib/destination/types/table_config_test.go @@ -2,7 +2,7 @@ package types_test import ( "math/rand" - "sort" + "slices" "sync" "testing" "time" @@ -173,7 +173,7 @@ func TestAuditColumnsToDelete(t *testing.T) { actualCols = []string{} } - sort.Strings(actualCols) + slices.Sort(actualCols) assert.Equal(t, tc.expectedColsRemain, actualCols, idx) } } diff --git a/lib/optimization/table_data_test.go b/lib/optimization/table_data_test.go index c54cc1b9f..7b2520e83 100644 --- a/lib/optimization/table_data_test.go +++ b/lib/optimization/table_data_test.go @@ -2,7 +2,7 @@ package optimization import ( "fmt" - "sort" + "slices" "testing" "time" @@ -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] { diff --git a/models/event/event.go b/models/event/event.go index 87b5f009f..9dc1ba7b6 100644 --- a/models/event/event.go +++ b/models/event/event.go @@ -4,7 +4,7 @@ import ( "cmp" "fmt" "log/slog" - "sort" + "slices" "strings" "time" @@ -153,7 +153,7 @@ func (e *Event) PrimaryKeys() []string { keys = append(keys, key) } - sort.Strings(keys) + slices.Sort(keys) return keys }