github.com/hedzr/evendeep@v0.4.8/def_init.go (about) 1 package evendeep 2 3 import "sync" 4 5 var onceInitRoutines sync.Once //nolint:gochecknoglobals //i know that 6 var otherRoutines = []func(){initConverters, initGlobalOperators} //nolint:gochecknoglobals //i know that 7 8 func init() { //nolint:gochecknoinits //don't 9 onceInitRoutines.Do(func() { 10 // initConverters() 11 // initGlobalOperators() 12 for _, fn := range otherRoutines { 13 if fn != nil { 14 fn() 15 } 16 } 17 }) 18 } 19 20 func initGlobalOperators() { 21 DefaultCopyController = newDeepCopier() 22 defaultCloneController = newCloner() 23 } 24 25 // ResetDefaultCopyController discards the changes for DefaultCopyController and more. 26 func ResetDefaultCopyController() { 27 initGlobalOperators() 28 }