From 5115813c50450869848e6cb23daa9ba827793535 Mon Sep 17 00:00:00 2001 From: heige Date: Wed, 28 Jul 2021 18:50:08 +0800 Subject: [PATCH] Fix preload fmt.Errorf formatter (#4531) --- callbacks/query.go | 2 +- migrator/migrator.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/callbacks/query.go b/callbacks/query.go index d0341284..3299d015 100644 --- a/callbacks/query.go +++ b/callbacks/query.go @@ -209,7 +209,7 @@ func Preload(db *gorm.DB) { if rel := db.Statement.Schema.Relationships.Relations[name]; rel != nil { preload(db, rel, db.Statement.Preloads[name], preloadMap[name]) } 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)) } } } diff --git a/migrator/migrator.go b/migrator/migrator.go index 7c7405b3..b42a62ca 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -616,7 +616,7 @@ func (m Migrator) CreateIndex(value interface{}, name string) 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) }) }