Skip to content

Commit edaa25b

Browse files
authored
Remove dependency on go-cmp (#394)
It was only being used in one file and we can replace the usage with a small helper function.
1 parent 718ecc7 commit edaa25b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.21
44

55
require (
66
github.com/cloudflare/backoff v0.0.0-20161212185259-647f3cdfc87a
7-
github.com/google/go-cmp v0.6.0
87
github.com/lib/pq v1.10.9
98
github.com/oapi-codegen/nullable v1.1.0
109
github.com/pterm/pterm v0.12.69

pkg/state/state_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/google/go-cmp/cmp"
16-
"github.com/google/go-cmp/cmp/cmpopts"
1715
"github.com/stretchr/testify/assert"
1816
"github.com/stretchr/testify/require"
1917
"github.com/xataio/pgroll/pkg/migrations"
@@ -265,9 +263,7 @@ func TestInferredMigration(t *testing.T) {
265263
assert.True(t, strings.HasPrefix(gotMigration.Name, "sql_") && len(gotMigration.Name) > 10)
266264
gotMigration.Name = ""
267265

268-
if diff := cmp.Diff(wantMigration, gotMigration); diff != "" {
269-
t.Errorf("expected schema mismatch (-want +got):\n%s", diff)
270-
}
266+
assert.Equal(t, wantMigration, gotMigration)
271267
}
272268
})
273269
}
@@ -815,10 +811,17 @@ func TestReadSchema(t *testing.T) {
815811
if err != nil {
816812
t.Fatal(err)
817813
}
818-
if diff := cmp.Diff(tt.wantSchema, gotSchema, cmpopts.IgnoreFields(schema.Table{}, "OID")); diff != "" {
819-
t.Errorf("expected schema mismatch (-want +got):\n%s", diff)
820-
}
814+
clearOIDS(gotSchema)
815+
assert.Equal(t, tt.wantSchema, gotSchema)
821816
})
822817
}
823818
})
824819
}
820+
821+
func clearOIDS(s *schema.Schema) {
822+
for k := range s.Tables {
823+
c := s.Tables[k]
824+
c.OID = ""
825+
s.Tables[k] = c
826+
}
827+
}

0 commit comments

Comments
 (0)