From 0eba7a9ed16f415c5a20dbfec8d6e3d7864b4fc8 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 26 Mar 2021 14:20:42 +0800 Subject: [PATCH] Fix apply option --- gorm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gorm.go b/gorm.go index 9323c46d..b612e1f4 100644 --- a/gorm.go +++ b/gorm.go @@ -116,9 +116,9 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) { if err := opt.Apply(config); err != nil { return nil, err } - defer func() { + defer func(opt Option) { opt.AfterInitialize(db) - }() + }(opt) } }