diff --git a/schema/schema_helper_test.go b/schema/schema_helper_test.go index 605aa03a..bc326686 100644 --- a/schema/schema_helper_test.go +++ b/schema/schema_helper_test.go @@ -163,8 +163,8 @@ func checkSchemaRelation(t *testing.T, s *schema.Schema, relation Relation) { t.Errorf("schema %v relation's join table tablename expects %v, but got %v", s, relation.JoinTable.Table, r.JoinTable.Table) } - for _, f := range relation.JoinTable.Fields { - checkSchemaField(t, r.JoinTable, &f, nil) + for i := range relation.JoinTable.Fields { + checkSchemaField(t, r.JoinTable, &relation.JoinTable.Fields[i], nil) } } diff --git a/schema/schema_test.go b/schema/schema_test.go index 5bc0fb83..45e152e9 100644 --- a/schema/schema_test.go +++ b/schema/schema_test.go @@ -46,8 +46,8 @@ func checkUserSchema(t *testing.T, user *schema.Schema) { {Name: "Active", DBName: "active", BindNames: []string{"Active"}, DataType: schema.Bool}, } - for _, f := range fields { - checkSchemaField(t, user, &f, func(f *schema.Field) { + for i := range fields { + checkSchemaField(t, user, &fields[i], func(f *schema.Field) { f.Creatable = true f.Updatable = true f.Readable = true @@ -136,8 +136,8 @@ func TestParseSchemaWithAdvancedDataType(t *testing.T) { {Name: "Admin", DBName: "admin", BindNames: []string{"Admin"}, DataType: schema.Bool}, } - for _, f := range fields { - checkSchemaField(t, user, &f, func(f *schema.Field) { + for i := range fields { + checkSchemaField(t, user, &fields[i], func(f *schema.Field) { f.Creatable = true f.Updatable = true f.Readable = true