19 lines
308 B
Go
19 lines
308 B
Go
|
package reg
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"dynatron.me/x/blasphem/pkg/component"
|
||
|
)
|
||
|
|
||
|
var Registry = make(map[component.Key]component.Setup)
|
||
|
|
||
|
func Register(key component.Key, c component.Setup) {
|
||
|
_, already := Registry[key]
|
||
|
if already {
|
||
|
panic(fmt.Sprintf("component %s already exists", key))
|
||
|
}
|
||
|
|
||
|
Registry[key] = c
|
||
|
}
|