diff --git a/daemon/libnetwork/drivers/ipvlan/ipvlan.go b/daemon/libnetwork/drivers/ipvlan/ipvlan.go index cde2312351..523bb7d314 100644 --- a/daemon/libnetwork/drivers/ipvlan/ipvlan.go +++ b/daemon/libnetwork/drivers/ipvlan/ipvlan.go @@ -30,12 +30,8 @@ const ( flagVepa = "vepa" // ipvlan flag vepa ) -type endpointTable map[string]*endpoint - -type networkTable map[string]*network - type driver struct { - networks networkTable + networks map[string]*network sync.Once sync.Mutex store *datastore.Store @@ -54,7 +50,7 @@ type endpoint struct { type network struct { id string - endpoints endpointTable + endpoints map[string]*endpoint driver *driver config *configuration sync.Mutex @@ -64,7 +60,7 @@ type network struct { func Register(r driverapi.Registerer, store *datastore.Store) error { d := &driver{ store: store, - networks: networkTable{}, + networks: map[string]*network{}, } if err := d.initStore(); err != nil { return err diff --git a/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go b/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go index 6238bf68a4..c19870ac04 100644 --- a/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go +++ b/daemon/libnetwork/drivers/ipvlan/ipvlan_network.go @@ -113,7 +113,7 @@ func (d *driver) createNetwork(config *configuration) (bool, error) { n := &network{ id: config.ID, driver: d, - endpoints: endpointTable{}, + endpoints: map[string]*endpoint{}, config: config, } // add the network diff --git a/daemon/libnetwork/drivers/macvlan/macvlan.go b/daemon/libnetwork/drivers/macvlan/macvlan.go index 0e6afa32ec..049439576c 100644 --- a/daemon/libnetwork/drivers/macvlan/macvlan.go +++ b/daemon/libnetwork/drivers/macvlan/macvlan.go @@ -24,12 +24,8 @@ const ( driverModeOpt = "macvlan_mode" // macvlan mode ux opt suffix ) -type endpointTable map[string]*endpoint - -type networkTable map[string]*network - type driver struct { - networks networkTable + networks map[string]*network sync.Once sync.Mutex store *datastore.Store @@ -48,7 +44,7 @@ type endpoint struct { type network struct { id string - endpoints endpointTable + endpoints map[string]*endpoint driver *driver config *configuration sync.Mutex @@ -58,7 +54,7 @@ type network struct { func Register(r driverapi.Registerer, store *datastore.Store) error { d := &driver{ store: store, - networks: networkTable{}, + networks: map[string]*network{}, } if err := d.initStore(); err != nil { return err diff --git a/daemon/libnetwork/drivers/macvlan/macvlan_network.go b/daemon/libnetwork/drivers/macvlan/macvlan_network.go index 08f62f4fb8..460d2f0c5c 100644 --- a/daemon/libnetwork/drivers/macvlan/macvlan_network.go +++ b/daemon/libnetwork/drivers/macvlan/macvlan_network.go @@ -131,7 +131,7 @@ func (d *driver) createNetwork(config *configuration) (bool, error) { d.addNetwork(&network{ id: config.ID, driver: d, - endpoints: endpointTable{}, + endpoints: map[string]*endpoint{}, config: config, }) }