Skip to content

Commit

Permalink
refactor: Resolve implicit memory aliasing in for loop (#6730)
Browse files Browse the repository at this point in the history
  • Loading branch information
BugKillerPro committed Dec 15, 2023
1 parent f0af94c commit 2fb4928
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions schema/schema_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2fb4928

Please sign in to comment.