diff --git a/orm/models_boot.go b/orm/models_boot.go index badfd11b..456e5896 100644 --- a/orm/models_boot.go +++ b/orm/models_boot.go @@ -335,11 +335,11 @@ func RegisterModelWithSuffix(suffix string, models ...interface{}) { // BootStrap bootstrap models. // make all model parsed and can not add more models func BootStrap() { + modelCache.Lock() + defer modelCache.Unlock() if modelCache.done { return } - modelCache.Lock() - defer modelCache.Unlock() bootStrap() modelCache.done = true }