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