mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Panic if trying to register an func with the same name
Signed-off-by: Michael Crosby <michael@docker.com>
This commit is contained in:
parent
9694209241
commit
1a249a5feb
1 changed files with 8 additions and 1 deletions
|
@ -1,11 +1,18 @@
|
|||
package reexec
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
var registeredInitializers = make(map[string]func())
|
||||
|
||||
// Register adds an initialization func under the specified name
|
||||
func Register(name string, initializer func()) {
|
||||
if _, exists := registeredInitializers[name]; exists {
|
||||
panic(fmt.Sprintf("reexec func already registred under name %q", name))
|
||||
}
|
||||
|
||||
registeredInitializers[name] = initializer
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue