mirror of https://github.com/go-gorm/gorm.git
refactor: Resolve implicit memory aliasing in for loop (#6730)
This commit is contained in:
parent
f0af94cd16
commit
2fb4928aa8
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue