mirror of https://github.com/docker/docs.git
Adding export Init method for the exported discovery components
Since Swarm discovery is used by libnetwork without the swarm main(), it is forced to use annonymous import in order to force-trigger the unexported init() methods. Using annonymous import is highly discouraged in a Non-Main and Non-Test packages. Introducing exported Init() methods on these files so that libnetwork can use Discovery as a library without having a main package. Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
c1494dd076
commit
23ecada9d7
|
@ -16,6 +16,11 @@ type Discovery struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
Init()
|
||||
}
|
||||
|
||||
// Init is exported
|
||||
func Init() {
|
||||
discovery.Register("file", &Discovery{})
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ type Discovery struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
Init()
|
||||
}
|
||||
|
||||
// Init is exported
|
||||
func Init() {
|
||||
discovery.Register("zk", &Discovery{backend: store.ZK})
|
||||
discovery.Register("consul", &Discovery{backend: store.CONSUL})
|
||||
discovery.Register("etcd", &Discovery{backend: store.ETCD})
|
||||
|
|
|
@ -13,6 +13,11 @@ type Discovery struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
Init()
|
||||
}
|
||||
|
||||
// Init is exported
|
||||
func Init() {
|
||||
discovery.Register("nodes", &Discovery{})
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,11 @@ type Discovery struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
Init()
|
||||
}
|
||||
|
||||
// Init is exported
|
||||
func Init() {
|
||||
discovery.Register("token", &Discovery{})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue