package blas import ( "fmt" ) type ( Setup func(Core) (Component, error) ComponentKey string Component interface { Shutdown() } ) var Registry = make(map[ComponentKey]Setup) func Register(key ComponentKey, c Setup) { _, already := Registry[key] if already { panic(fmt.Sprintf("component %s already exists", key)) } Registry[key] = c }