Fix preload fmt.Errorf formatter (#4531)

This commit is contained in:
heige 2021-07-28 18:50:08 +08:00 committed by GitHub
parent 2202e99cbf
commit 5115813c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -209,7 +209,7 @@ func Preload(db *gorm.DB) {
if rel := db.Statement.Schema.Relationships.Relations[name]; rel != nil { if rel := db.Statement.Schema.Relationships.Relations[name]; rel != nil {
preload(db, rel, db.Statement.Preloads[name], preloadMap[name]) preload(db, rel, db.Statement.Preloads[name], preloadMap[name])
} else { } else {
db.AddError(fmt.Errorf("%v: %w for schema %v", name, gorm.ErrUnsupportedRelation, db.Statement.Schema.Name)) db.AddError(fmt.Errorf("%s: %w for schema %s", name, gorm.ErrUnsupportedRelation, db.Statement.Schema.Name))
} }
} }
} }

View File

@ -616,7 +616,7 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
return m.DB.Exec(createIndexSQL, values...).Error return m.DB.Exec(createIndexSQL, values...).Error
} }
return fmt.Errorf("failed to create index with name %v", name) return fmt.Errorf("failed to create index with name %s", name)
}) })
} }