فهرست منبع

libnetwork: fix empty-lines (revive)

    libnetwork/etchosts/etchosts_test.go:167:54: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/osl/route_linux.go:185:74: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/osl/sandbox_linux_test.go:323:36: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/bitseq/sequence.go:412:48: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/datastore/datastore_test.go:67:46: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/datastore/mock_store.go:34:60: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/iptables/firewalld.go:202:44: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/iptables/firewalld_test.go:76:36: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/iptables/iptables.go:256:67: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/iptables/iptables.go:303:128: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/networkdb/cluster.go:183:72: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/ipams/null/null_test.go:44:38: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/macvlan/macvlan_store.go:45:52: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/ipam/allocator_test.go:1058:39: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/bridge/port_mapping.go:88:111: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/bridge/link.go:26:90: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/bridge/setup_ipv6_test.go:17:34: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/bridge/setup_ip_tables.go:392:4: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/bridge/bridge.go:804:50: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/ov_serf.go:183:29: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/ov_utils.go:81:64: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/overlay/peerdb.go:172:67: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/peerdb.go:209:67: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/peerdb.go:344:89: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/peerdb.go:436:63: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/overlay.go:183:36: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/drivers/overlay/encryption.go:69:28: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/drivers/overlay/ov_network.go:563:81: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/default_gateway.go:32:43: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/errors_test.go:9:40: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/service_common.go:184:64: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/endpoint.go:161:55: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/store.go:320:33: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/store_linux_test.go:11:38: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/sandbox.go:571:36: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/service_common.go:317:246: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/endpoint.go:550:17: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/sandbox_dns_unix.go:213:106: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/controller.go:676:85: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/agent.go:876:60: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/resolver.go:324:69: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/network.go:1153:92: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/network.go:1955:67: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/network.go:2235:9: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/libnetwork_internal_test.go:336:26: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/resolver_test.go:76:35: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/libnetwork_test.go:303:38: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/libnetwork_test.go:985:46: empty-lines: extra empty line at the end of a block (revive)
    libnetwork/ipam/allocator_test.go:1263:37: empty-lines: extra empty line at the start of a block (revive)
    libnetwork/errors_test.go:9:40: empty-lines: extra empty line at the end of a block (revive)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 سال پیش
والد
کامیت
cd381aea56
40فایلهای تغییر یافته به همراه11 افزوده شده و 72 حذف شده
  1. 0 1
      libnetwork/agent.go
  2. 0 1
      libnetwork/bitseq/sequence.go
  3. 0 1
      libnetwork/controller.go
  4. 0 1
      libnetwork/datastore/datastore_test.go
  5. 0 1
      libnetwork/datastore/mock_store.go
  6. 0 1
      libnetwork/default_gateway.go
  7. 0 1
      libnetwork/drivers/bridge/bridge.go
  8. 0 1
      libnetwork/drivers/bridge/link.go
  9. 1 2
      libnetwork/drivers/bridge/port_mapping.go
  10. 0 1
      libnetwork/drivers/bridge/setup_ip_tables.go
  11. 0 1
      libnetwork/drivers/bridge/setup_ipv6_test.go
  12. 0 1
      libnetwork/drivers/macvlan/macvlan_store.go
  13. 1 3
      libnetwork/drivers/overlay/encryption.go
  14. 1 2
      libnetwork/drivers/overlay/ov_network.go
  15. 1 3
      libnetwork/drivers/overlay/ov_serf.go
  16. 0 1
      libnetwork/drivers/overlay/ov_utils.go
  17. 0 1
      libnetwork/drivers/overlay/overlay.go
  18. 4 12
      libnetwork/drivers/overlay/peerdb.go
  19. 0 2
      libnetwork/endpoint.go
  20. 0 2
      libnetwork/errors_test.go
  21. 0 1
      libnetwork/etchosts/etchosts_test.go
  22. 0 4
      libnetwork/ipam/allocator_test.go
  23. 0 1
      libnetwork/ipams/null/null_test.go
  24. 1 3
      libnetwork/iptables/firewalld.go
  25. 0 1
      libnetwork/iptables/firewalld_test.go
  26. 0 2
      libnetwork/iptables/iptables.go
  27. 0 1
      libnetwork/libnetwork_internal_test.go
  28. 0 2
      libnetwork/libnetwork_test.go
  29. 0 3
      libnetwork/network.go
  30. 0 1
      libnetwork/networkdb/cluster.go
  31. 0 1
      libnetwork/osl/namespace_linux.go
  32. 0 1
      libnetwork/osl/route_linux.go
  33. 0 1
      libnetwork/osl/sandbox_linux_test.go
  34. 0 1
      libnetwork/resolver.go
  35. 0 1
      libnetwork/resolver_test.go
  36. 0 1
      libnetwork/sandbox.go
  37. 2 4
      libnetwork/sandbox_dns_unix.go
  38. 0 2
      libnetwork/service_common.go
  39. 0 1
      libnetwork/store.go
  40. 0 1
      libnetwork/store_linux_test.go

+ 0 - 1
libnetwork/agent.go

@@ -895,7 +895,6 @@ func (c *controller) handleNodeTableEvent(ev events.Event) {
 		return
 		return
 	}
 	}
 	c.processNodeDiscovery([]net.IP{nodeAddr.Addr}, isAdd)
 	c.processNodeDiscovery([]net.IP{nodeAddr.Addr}, isAdd)
-
 }
 }
 
 
 func (c *controller) handleEpTableEvent(ev events.Event) {
 func (c *controller) handleEpTableEvent(ev events.Event) {

+ 0 - 1
libnetwork/bitseq/sequence.go

@@ -410,7 +410,6 @@ func (h *Handle) Destroy() error {
 
 
 // ToByteArray converts this handle's data into a byte array
 // ToByteArray converts this handle's data into a byte array
 func (h *Handle) ToByteArray() ([]byte, error) {
 func (h *Handle) ToByteArray() ([]byte, error) {
-
 	h.Lock()
 	h.Lock()
 	defer h.Unlock()
 	defer h.Unlock()
 	ba := make([]byte, 16)
 	ba := make([]byte, 16)

+ 0 - 1
libnetwork/controller.go

@@ -675,7 +675,6 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
 
 
 	if network.scope == datastore.LocalScope && cap.DataScope == datastore.GlobalScope {
 	if network.scope == datastore.LocalScope && cap.DataScope == datastore.GlobalScope {
 		return nil, types.ForbiddenErrorf("cannot downgrade network scope for %s networks", networkType)
 		return nil, types.ForbiddenErrorf("cannot downgrade network scope for %s networks", networkType)
-
 	}
 	}
 	if network.ingress && cap.DataScope != datastore.GlobalScope {
 	if network.ingress && cap.DataScope != datastore.GlobalScope {
 		return nil, types.ForbiddenErrorf("Ingress network can only be global scope network")
 		return nil, types.ForbiddenErrorf("Ingress network can only be global scope network")

+ 0 - 1
libnetwork/datastore/datastore_test.go

@@ -108,7 +108,6 @@ func TestAtomicKVObjectFlatKey(t *testing.T) {
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
-
 }
 }
 
 
 // dummy data used to test the datastore
 // dummy data used to test the datastore

+ 0 - 1
libnetwork/datastore/mock_store.go

@@ -37,7 +37,6 @@ func (s *MockStore) Get(key string) (*store.KVPair, error) {
 		return nil, nil
 		return nil, nil
 	}
 	}
 	return &store.KVPair{Value: mData.Data, LastIndex: mData.Index}, nil
 	return &store.KVPair{Value: mData.Data, LastIndex: mData.Index}, nil
-
 }
 }
 
 
 // Put a value at "key"
 // Put a value at "key"

+ 0 - 1
libnetwork/default_gateway.go

@@ -30,7 +30,6 @@ var procGwNetwork = make(chan (bool), 1)
 */
 */
 
 
 func (sb *sandbox) setupDefaultGW() error {
 func (sb *sandbox) setupDefaultGW() error {
-
 	// check if the container already has a GW endpoint
 	// check if the container already has a GW endpoint
 	if ep := sb.getEndpointInGWNetwork(); ep != nil {
 	if ep := sb.getEndpointInGWNetwork(); ep != nil {
 		return nil
 		return nil

+ 0 - 1
libnetwork/drivers/bridge/bridge.go

@@ -802,7 +802,6 @@ func (d *driver) createNetwork(config *networkConfiguration) (err error) {
 }
 }
 
 
 func (d *driver) DeleteNetwork(nid string) error {
 func (d *driver) DeleteNetwork(nid string) error {
-
 	d.configNetwork.Lock()
 	d.configNetwork.Lock()
 	defer d.configNetwork.Unlock()
 	defer d.configNetwork.Unlock()
 
 

+ 0 - 1
libnetwork/drivers/bridge/link.go

@@ -30,7 +30,6 @@ func newLink(parentIP, childIP string, ports []types.TransportPort, bridge strin
 		ports:    ports,
 		ports:    ports,
 		bridge:   bridge,
 		bridge:   bridge,
 	}
 	}
-
 }
 }
 
 
 func (l *link) Enable() error {
 func (l *link) Enable() error {

+ 1 - 2
libnetwork/drivers/bridge/port_mapping.go

@@ -86,7 +86,7 @@ func (n *bridgeNetwork) allocatePortsInternal(bindings []types.PortBinding, cont
 // validatePortBindingIPv4 validates the port binding, populates the missing Host IP field and returns true
 // validatePortBindingIPv4 validates the port binding, populates the missing Host IP field and returns true
 // if this is a valid IPv4 binding, else returns false
 // if this is a valid IPv4 binding, else returns false
 func (n *bridgeNetwork) validatePortBindingIPv4(bnd *types.PortBinding, containerIPv4, defHostIP net.IP) bool {
 func (n *bridgeNetwork) validatePortBindingIPv4(bnd *types.PortBinding, containerIPv4, defHostIP net.IP) bool {
-	//Return early if there is a valid Host IP, but its not a IPv4 address
+	// Return early if there is a valid Host IP, but its not a IPv4 address
 	if len(bnd.HostIP) > 0 && bnd.HostIP.To4() == nil {
 	if len(bnd.HostIP) > 0 && bnd.HostIP.To4() == nil {
 		return false
 		return false
 	}
 	}
@@ -100,7 +100,6 @@ func (n *bridgeNetwork) validatePortBindingIPv4(bnd *types.PortBinding, containe
 	}
 	}
 	bnd.IP = containerIPv4
 	bnd.IP = containerIPv4
 	return true
 	return true
-
 }
 }
 
 
 // validatePortBindingIPv6 validates the port binding, populates the missing Host IP field and returns true
 // validatePortBindingIPv6 validates the port binding, populates the missing Host IP field and returns true

+ 0 - 1
libnetwork/drivers/bridge/setup_ip_tables.go

@@ -390,7 +390,6 @@ func removeIPChains(version iptables.IPVersion) {
 		{Name: IsolationChain2, Table: iptables.Filter, IPTable: ipt},
 		{Name: IsolationChain2, Table: iptables.Filter, IPTable: ipt},
 		{Name: oldIsolationChain, Table: iptables.Filter, IPTable: ipt},
 		{Name: oldIsolationChain, Table: iptables.Filter, IPTable: ipt},
 	} {
 	} {
-
 		if err := chainInfo.Remove(); err != nil {
 		if err := chainInfo.Remove(); err != nil {
 			logrus.Warnf("Failed to remove existing iptables entries in table %s chain %s : %v", chainInfo.Table, chainInfo.Name, err)
 			logrus.Warnf("Failed to remove existing iptables entries in table %s chain %s : %v", chainInfo.Table, chainInfo.Name, err)
 		}
 		}

+ 0 - 1
libnetwork/drivers/bridge/setup_ipv6_test.go

@@ -53,7 +53,6 @@ func TestSetupIPv6(t *testing.T) {
 	if !found {
 	if !found {
 		t.Fatalf("Bridge device does not have requested IPv6 address %v", bridgeIPv6)
 		t.Fatalf("Bridge device does not have requested IPv6 address %v", bridgeIPv6)
 	}
 	}
-
 }
 }
 
 
 func TestSetupGatewayIPv6(t *testing.T) {
 func TestSetupGatewayIPv6(t *testing.T) {

+ 0 - 1
libnetwork/drivers/macvlan/macvlan_store.go

@@ -61,7 +61,6 @@ func (d *driver) initStore(option map[string]interface{}) error {
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}
-
 	}
 	}
 
 
 	return nil
 	return nil

+ 1 - 3
libnetwork/drivers/overlay/encryption.go

@@ -10,11 +10,10 @@ import (
 	"fmt"
 	"fmt"
 	"hash/fnv"
 	"hash/fnv"
 	"net"
 	"net"
+	"strconv"
 	"sync"
 	"sync"
 	"syscall"
 	"syscall"
 
 
-	"strconv"
-
 	"github.com/docker/docker/libnetwork/drivers/overlay/overlayutils"
 	"github.com/docker/docker/libnetwork/drivers/overlay/overlayutils"
 	"github.com/docker/docker/libnetwork/iptables"
 	"github.com/docker/docker/libnetwork/iptables"
 	"github.com/docker/docker/libnetwork/ns"
 	"github.com/docker/docker/libnetwork/ns"
@@ -76,7 +75,6 @@ func (e *encrMap) String() string {
 			b.WriteString(",")
 			b.WriteString(",")
 		}
 		}
 		b.WriteString("]")
 		b.WriteString("]")
-
 	}
 	}
 	return b.String()
 	return b.String()
 }
 }

+ 1 - 2
libnetwork/drivers/overlay/ov_network.go

@@ -561,7 +561,6 @@ func (n *network) restoreSubnetSandbox(s *subnet, brName, vxlanName string) erro
 }
 }
 
 
 func (n *network) setupSubnetSandbox(s *subnet, brName, vxlanName string) error {
 func (n *network) setupSubnetSandbox(s *subnet, brName, vxlanName string) error {
-
 	if hostMode {
 	if hostMode {
 		// Try to delete stale bridge interface if it exists
 		// Try to delete stale bridge interface if it exists
 		if err := deleteInterface(brName); err != nil {
 		if err := deleteInterface(brName); err != nil {
@@ -1076,7 +1075,7 @@ func (n *network) releaseVxlanID() ([]uint32, error) {
 }
 }
 
 
 func (n *network) obtainVxlanID(s *subnet) error {
 func (n *network) obtainVxlanID(s *subnet) error {
-	//return if the subnet already has a vxlan id assigned
+	// return if the subnet already has a vxlan id assigned
 	if n.vxlanID(s) != 0 {
 	if n.vxlanID(s) != 0 {
 		return nil
 		return nil
 	}
 	}

+ 1 - 3
libnetwork/drivers/overlay/ov_serf.go

@@ -179,9 +179,7 @@ func (d *driver) resolvePeer(nid string, peerIP net.IP) (net.HardwareAddr, net.I
 	}
 	}
 }
 }
 
 
-func (d *driver) startSerfLoop(eventCh chan serf.Event, notifyCh chan ovNotify,
-	exitCh chan chan struct{}) {
-
+func (d *driver) startSerfLoop(eventCh chan serf.Event, notifyCh chan ovNotify, exitCh chan chan struct{}) {
 	for {
 	for {
 		select {
 		select {
 		case notify, ok := <-notifyCh:
 		case notify, ok := <-notifyCh:

+ 0 - 1
libnetwork/drivers/overlay/ov_utils.go

@@ -106,7 +106,6 @@ func deleteInterfaceBySubnet(brPrefix string, s *subnet) error {
 		}
 		}
 	}
 	}
 	return nil
 	return nil
-
 }
 }
 
 
 func deleteInterface(name string) error {
 func deleteInterface(name string) error {

+ 0 - 1
libnetwork/drivers/overlay/overlay.go

@@ -181,7 +181,6 @@ func Fini(drv driverapi.Driver) {
 }
 }
 
 
 func (d *driver) configure() error {
 func (d *driver) configure() error {
-
 	// Apply OS specific kernel configs if needed
 	// Apply OS specific kernel configs if needed
 	d.initOS.Do(applyOStweaks)
 	d.initOS.Do(applyOStweaks)
 
 

+ 4 - 12
libnetwork/drivers/overlay/peerdb.go

@@ -168,9 +168,7 @@ func (d *driver) peerDbSearch(nid string, peerIP net.IP) (*peerKey, *peerEntry,
 	return pKeyMatched, pEntryMatched, nil
 	return pKeyMatched, pEntryMatched, nil
 }
 }
 
 
-func (d *driver) peerDbAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
-	peerMac net.HardwareAddr, vtep net.IP, isLocal bool) (bool, int) {
-
+func (d *driver) peerDbAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, isLocal bool) (bool, int) {
 	d.peerDb.Lock()
 	d.peerDb.Lock()
 	pMap, ok := d.peerDb.mp[nid]
 	pMap, ok := d.peerDb.mp[nid]
 	if !ok {
 	if !ok {
@@ -205,9 +203,7 @@ func (d *driver) peerDbAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask
 	return b, i
 	return b, i
 }
 }
 
 
-func (d *driver) peerDbDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
-	peerMac net.HardwareAddr, vtep net.IP, isLocal bool) (bool, int) {
-
+func (d *driver) peerDbDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, isLocal bool) (bool, int) {
 	d.peerDb.Lock()
 	d.peerDb.Lock()
 	pMap, ok := d.peerDb.mp[nid]
 	pMap, ok := d.peerDb.mp[nid]
 	if !ok {
 	if !ok {
@@ -340,9 +336,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
 	}
 	}
 }
 }
 
 
-func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
-	peerMac net.HardwareAddr, vtep net.IP, l2Miss, l3Miss, updateDB, localPeer bool) error {
-
+func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, l2Miss, l3Miss, updateDB, localPeer bool) error {
 	if err := validateID(nid, eid); err != nil {
 	if err := validateID(nid, eid); err != nil {
 		return err
 		return err
 	}
 	}
@@ -432,9 +426,7 @@ func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMas
 	}
 	}
 }
 }
 
 
-func (d *driver) peerDeleteOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
-	peerMac net.HardwareAddr, vtep net.IP, localPeer bool) error {
-
+func (d *driver) peerDeleteOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, localPeer bool) error {
 	if err := validateID(nid, eid); err != nil {
 	if err := validateID(nid, eid); err != nil {
 		return err
 		return err
 	}
 	}

+ 0 - 2
libnetwork/endpoint.go

@@ -178,7 +178,6 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
 				tplist = append(tplist, tp)
 				tplist = append(tplist, tp)
 			}
 			}
 			ep.generic[netlabel.ExposedPorts] = tplist
 			ep.generic[netlabel.ExposedPorts] = tplist
-
 		}
 		}
 	}
 	}
 
 
@@ -580,7 +579,6 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) (err error) {
 					ep.Name(), ep.ID(), err)
 					ep.Name(), ep.ID(), err)
 			}
 			}
 		}
 		}
-
 	}
 	}
 
 
 	if !sb.needDefaultGW() {
 	if !sb.needDefaultGW() {

+ 0 - 2
libnetwork/errors_test.go

@@ -7,7 +7,6 @@ import (
 )
 )
 
 
 func TestErrorInterfaces(t *testing.T) {
 func TestErrorInterfaces(t *testing.T) {
-
 	badRequestErrorList := []error{ErrInvalidID(""), ErrInvalidName(""), ErrInvalidJoin{}, ErrInvalidNetworkDriver(""), InvalidContainerIDError(""), ErrNoSuchNetwork(""), ErrNoSuchEndpoint("")}
 	badRequestErrorList := []error{ErrInvalidID(""), ErrInvalidName(""), ErrInvalidJoin{}, ErrInvalidNetworkDriver(""), InvalidContainerIDError(""), ErrNoSuchNetwork(""), ErrNoSuchEndpoint("")}
 	for _, err := range badRequestErrorList {
 	for _, err := range badRequestErrorList {
 		switch u := err.(type) {
 		switch u := err.(type) {
@@ -47,5 +46,4 @@ func TestErrorInterfaces(t *testing.T) {
 			t.Fatalf("Failed to detect err %v is of type ForbiddenError. Got type: %T", err, u)
 			t.Fatalf("Failed to detect err %v is of type ForbiddenError. Got type: %T", err, u)
 		}
 		}
 	}
 	}
-
 }
 }

+ 0 - 1
libnetwork/etchosts/etchosts_test.go

@@ -209,7 +209,6 @@ func TestUpdateIgnoresPrefixedHostname(t *testing.T) {
 	if expected := "5.5.5.5\tprefix\n3.3.3.3\tprefixAndMore\n4.4.4.4\tunaffectedHost\n"; !bytes.Contains(content, []byte(expected)) {
 	if expected := "5.5.5.5\tprefix\n3.3.3.3\tprefixAndMore\n4.4.4.4\tunaffectedHost\n"; !bytes.Contains(content, []byte(expected)) {
 		t.Fatalf("Expected to find '%s' got '%s'", expected, content)
 		t.Fatalf("Expected to find '%s' got '%s'", expected, content)
 	}
 	}
-
 }
 }
 
 
 // This regression test covers the host prefix issue for the
 // This regression test covers the host prefix issue for the

+ 0 - 4
libnetwork/ipam/allocator_test.go

@@ -1056,7 +1056,6 @@ func TestOverlappingRequests(t *testing.T) {
 }
 }
 
 
 func TestUnusualSubnets(t *testing.T) {
 func TestUnusualSubnets(t *testing.T) {
-
 	subnet := "192.168.0.2/31"
 	subnet := "192.168.0.2/31"
 
 
 	outsideTheRangeAddresses := []struct {
 	outsideTheRangeAddresses := []struct {
@@ -1075,7 +1074,6 @@ func TestUnusualSubnets(t *testing.T) {
 	}
 	}
 
 
 	for _, store := range []bool{false, true} {
 	for _, store := range []bool{false, true} {
-
 		allocator, err := getAllocator(store)
 		allocator, err := getAllocator(store)
 		if err != nil {
 		if err != nil {
 			t.Fatal(err)
 			t.Fatal(err)
@@ -1117,7 +1115,6 @@ func TestUnusualSubnets(t *testing.T) {
 		if err != ipamapi.ErrNoAvailableIPs {
 		if err != ipamapi.ErrNoAvailableIPs {
 			t.Fatal("Did not get expected error when pool is exhausted.")
 			t.Fatal("Did not get expected error when pool is exhausted.")
 		}
 		}
-
 	}
 	}
 }
 }
 
 
@@ -1264,7 +1261,6 @@ func benchmarkRequest(b *testing.B, a *Allocator, subnet string) {
 }
 }
 
 
 func BenchmarkRequest(b *testing.B) {
 func BenchmarkRequest(b *testing.B) {
-
 	subnets := []string{
 	subnets := []string{
 		"10.0.0.0/24",
 		"10.0.0.0/24",
 		"10.0.0.0/16",
 		"10.0.0.0/16",

+ 0 - 1
libnetwork/ipams/null/null_test.go

@@ -56,5 +56,4 @@ func TestOtherRequests(t *testing.T) {
 	if err == nil {
 	if err == nil {
 		t.Fatal("Unexpected success")
 		t.Fatal("Unexpected success")
 	}
 	}
-
 }
 }

+ 1 - 3
libnetwork/iptables/firewalld.go

@@ -206,7 +206,7 @@ func getDockerZoneSettings() []interface{} {
 		description: "zone for docker bridge network interfaces",
 		description: "zone for docker bridge network interfaces",
 		target:      "ACCEPT",
 		target:      "ACCEPT",
 	}
 	}
-	slice := []interface{}{
+	return []interface{}{
 		settings.version,
 		settings.version,
 		settings.name,
 		settings.name,
 		settings.description,
 		settings.description,
@@ -224,8 +224,6 @@ func getDockerZoneSettings() []interface{} {
 		settings.sourcePorts,
 		settings.sourcePorts,
 		settings.icmpBlockInversion,
 		settings.icmpBlockInversion,
 	}
 	}
-	return slice
-
 }
 }
 
 
 // setupDockerZone creates a zone called docker in firewalld which includes docker interfaces to allow
 // setupDockerZone creates a zone called docker in firewalld which includes docker interfaces to allow

+ 0 - 1
libnetwork/iptables/firewalld_test.go

@@ -90,5 +90,4 @@ func TestPassthrough(t *testing.T) {
 			t.Fatal("rule1 does not exist")
 			t.Fatal("rule1 does not exist")
 		}
 		}
 	}
 	}
-
 }
 }

+ 0 - 2
libnetwork/iptables/iptables.go

@@ -260,7 +260,6 @@ func (iptable IPTable) ProgramChain(c *ChainInfo, bridgeName string, hairpinMode
 			} else if len(output) != 0 {
 			} else if len(output) != 0 {
 				return fmt.Errorf("Could not delete linking rule from %s/%s: %s", c.Table, c.Name, output)
 				return fmt.Errorf("Could not delete linking rule from %s/%s: %s", c.Table, c.Name, output)
 			}
 			}
-
 		}
 		}
 		establish := []string{
 		establish := []string{
 			"-o", bridgeName,
 			"-o", bridgeName,
@@ -301,7 +300,6 @@ func (iptable IPTable) RemoveExistingChain(name string, table Table) error {
 
 
 // Forward adds forwarding rule to 'filter' table and corresponding nat rule to 'nat' table.
 // Forward adds forwarding rule to 'filter' table and corresponding nat rule to 'nat' table.
 func (c *ChainInfo) Forward(action Action, ip net.IP, port int, proto, destAddr string, destPort int, bridgeName string) error {
 func (c *ChainInfo) Forward(action Action, ip net.IP, port int, proto, destAddr string, destPort int, bridgeName string) error {
-
 	iptable := GetIptable(c.IPTable.Version)
 	iptable := GetIptable(c.IPTable.Version)
 	daddr := ip.String()
 	daddr := ip.String()
 	if ip.IsUnspecified() {
 	if ip.IsUnspecified() {

+ 0 - 1
libnetwork/libnetwork_internal_test.go

@@ -334,7 +334,6 @@ func TestAuxAddresses(t *testing.T) {
 	}
 	}
 
 
 	for _, i := range input {
 	for _, i := range input {
-
 		n.ipamV4Config = []*IpamConf{{PreferredPool: i.masterPool, SubPool: i.subPool, AuxAddresses: i.auxAddresses}}
 		n.ipamV4Config = []*IpamConf{{PreferredPool: i.masterPool, SubPool: i.subPool, AuxAddresses: i.auxAddresses}}
 
 
 		err = n.ipamAllocate()
 		err = n.ipamAllocate()

+ 0 - 2
libnetwork/libnetwork_test.go

@@ -400,7 +400,6 @@ func TestNetworkConfig(t *testing.T) {
 	if err := configNetwork.Delete(); err != nil {
 	if err := configNetwork.Delete(); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
-
 }
 }
 
 
 func TestUnknownNetwork(t *testing.T) {
 func TestUnknownNetwork(t *testing.T) {
@@ -1054,7 +1053,6 @@ func TestEndpointMultipleJoins(t *testing.T) {
 	if _, ok := err.(types.ForbiddenError); !ok {
 	if _, ok := err.(types.ForbiddenError); !ok {
 		t.Fatalf("Failed with unexpected error type: %T. Desc: %s", err, err.Error())
 		t.Fatalf("Failed with unexpected error type: %T. Desc: %s", err, err.Error())
 	}
 	}
-
 }
 }
 
 
 func TestLeaveAll(t *testing.T) {
 func TestLeaveAll(t *testing.T) {

+ 0 - 3
libnetwork/network.go

@@ -1168,7 +1168,6 @@ func (n *network) CreateEndpoint(name string, options ...EndpointOption) (Endpoi
 	defer n.ctrlr.networkLocker.Unlock(n.id) //nolint:errcheck
 	defer n.ctrlr.networkLocker.Unlock(n.id) //nolint:errcheck
 
 
 	return n.createEndpoint(name, options...)
 	return n.createEndpoint(name, options...)
-
 }
 }
 
 
 func (n *network) createEndpoint(name string, options ...EndpointOption) (Endpoint, error) {
 func (n *network) createEndpoint(name string, options ...EndpointOption) (Endpoint, error) {
@@ -1953,7 +1952,6 @@ func (n *network) TableEventRegister(tableName string, objType driverapi.ObjectT
 }
 }
 
 
 func (n *network) UpdateIpamConfig(ipV4Data []driverapi.IPAMData) {
 func (n *network) UpdateIpamConfig(ipV4Data []driverapi.IPAMData) {
-
 	ipamV4Config := make([]*IpamConf, len(ipV4Data))
 	ipamV4Config := make([]*IpamConf, len(ipV4Data))
 
 
 	for i, data := range ipV4Data {
 	for i, data := range ipV4Data {
@@ -2233,7 +2231,6 @@ func (n *network) deleteLoadBalancerSandbox() error {
 	if err != nil {
 	if err != nil {
 		logrus.Warnf("Failed to find load balancer endpoint %s on network %s: %v", endpointName, name, err)
 		logrus.Warnf("Failed to find load balancer endpoint %s on network %s: %v", endpointName, name, err)
 	} else {
 	} else {
-
 		info := endpoint.Info()
 		info := endpoint.Info()
 		if info != nil {
 		if info != nil {
 			sb := info.Sandbox()
 			sb := info.Sandbox()

+ 0 - 1
libnetwork/networkdb/cluster.go

@@ -200,7 +200,6 @@ func (nDB *NetworkDB) retryJoin(ctx context.Context, members []string) {
 			return
 			return
 		}
 		}
 	}
 	}
-
 }
 }
 
 
 func (nDB *NetworkDB) clusterJoin(members []string) error {
 func (nDB *NetworkDB) clusterJoin(members []string) error {

+ 0 - 1
libnetwork/osl/namespace_linux.go

@@ -177,7 +177,6 @@ func GenerateKey(containerID string) string {
 					index = tmpindex
 					index = tmpindex
 					tmpkey = id
 					tmpkey = id
 				}
 				}
-
 			}
 			}
 		}
 		}
 		containerID = tmpkey
 		containerID = tmpkey

+ 0 - 1
libnetwork/osl/route_linux.go

@@ -183,7 +183,6 @@ func (n *networkNamespace) AddStaticRoute(r *types.StaticRoute) error {
 }
 }
 
 
 func (n *networkNamespace) RemoveStaticRoute(r *types.StaticRoute) error {
 func (n *networkNamespace) RemoveStaticRoute(r *types.StaticRoute) error {
-
 	err := n.removeRoute(n.nsPath(), r.Destination, r.NextHop)
 	err := n.removeRoute(n.nsPath(), r.Destination, r.NextHop)
 	if err == nil {
 	if err == nil {
 		n.Lock()
 		n.Lock()

+ 0 - 1
libnetwork/osl/sandbox_linux_test.go

@@ -321,7 +321,6 @@ func TestSetInterfaceIP(t *testing.T) {
 }
 }
 
 
 func TestLiveRestore(t *testing.T) {
 func TestLiveRestore(t *testing.T) {
-
 	defer testutils.SetupTestOSContext(t)()
 	defer testutils.SetupTestOSContext(t)()
 
 
 	key, err := newKey(t)
 	key, err := newKey(t)

+ 0 - 1
libnetwork/resolver.go

@@ -347,7 +347,6 @@ func (r *resolver) handleSRVQuery(query *dns.Msg) (*dns.Msg, error) {
 		resp.Extra = append(resp.Extra, rr1)
 		resp.Extra = append(resp.Extra, rr1)
 	}
 	}
 	return resp, nil
 	return resp, nil
-
 }
 }
 
 
 func truncateResp(resp *dns.Msg, maxSize int, isTCP bool) {
 func truncateResp(resp *dns.Msg, maxSize int, isTCP bool) {

+ 0 - 1
libnetwork/resolver_test.go

@@ -166,7 +166,6 @@ func TestDNSIPQuery(t *testing.T) {
 	t.Log("Response: ", resp.String())
 	t.Log("Response: ", resp.String())
 	checkDNSResponseCode(t, resp, dns.RcodeServerFailure)
 	checkDNSResponseCode(t, resp, dns.RcodeServerFailure)
 	w.ClearResponse()
 	w.ClearResponse()
-
 }
 }
 
 
 func newDNSHandlerServFailOnce(requests *int) func(w dns.ResponseWriter, r *dns.Msg) {
 func newDNSHandlerServFailOnce(requests *int) func(w dns.ResponseWriter, r *dns.Msg) {

+ 0 - 1
libnetwork/sandbox.go

@@ -569,7 +569,6 @@ func (sb *sandbox) ResolveName(name string, ipType int) ([]net.IP, bool) {
 	}
 	}
 
 
 	for i := 0; i < len(reqName); i++ {
 	for i := 0; i < len(reqName); i++ {
-
 		// First check for local container alias
 		// First check for local container alias
 		ip, ipv6Miss := sb.resolveName(reqName[i], networkName[i], epList, true, ipType)
 		ip, ipv6Miss := sb.resolveName(reqName[i], networkName[i], epList, true, ipType)
 		if ip != nil {
 		if ip != nil {

+ 2 - 4
libnetwork/sandbox_dns_unix.go

@@ -209,9 +209,7 @@ func (sb *sandbox) setupDNS() error {
 
 
 	// When the user specify a conainter in the host namespace and do no have any dns option specified
 	// When the user specify a conainter in the host namespace and do no have any dns option specified
 	// we just copy the host resolv.conf from the host itself
 	// we just copy the host resolv.conf from the host itself
-	if sb.config.useDefaultSandBox &&
-		len(sb.config.dnsList) == 0 && len(sb.config.dnsSearchList) == 0 && len(sb.config.dnsOptionsList) == 0 {
-
+	if sb.config.useDefaultSandBox && len(sb.config.dnsList) == 0 && len(sb.config.dnsSearchList) == 0 && len(sb.config.dnsOptionsList) == 0 {
 		// We are working under the assumption that the origin file option had been properly expressed by the upper layer
 		// We are working under the assumption that the origin file option had been properly expressed by the upper layer
 		// if not here we are going to error out
 		// if not here we are going to error out
 		if err := copyFile(sb.config.originResolvConfPath, sb.config.resolvConfPath); err != nil {
 		if err := copyFile(sb.config.originResolvConfPath, sb.config.resolvConfPath); err != nil {
@@ -325,7 +323,7 @@ func (sb *sandbox) updateDNS(ipv6Enabled bool) error {
 	if currHash != "" && currHash != currRC.Hash {
 	if currHash != "" && currHash != currRC.Hash {
 		// Seems the user has changed the container resolv.conf since the last time
 		// Seems the user has changed the container resolv.conf since the last time
 		// we checked so return without doing anything.
 		// we checked so return without doing anything.
-		//logrus.Infof("Skipping update of resolv.conf file with ipv6Enabled: %t because file was touched by user", ipv6Enabled)
+		// logrus.Infof("Skipping update of resolv.conf file with ipv6Enabled: %t because file was touched by user", ipv6Enabled)
 		return nil
 		return nil
 	}
 	}
 
 

+ 0 - 2
libnetwork/service_common.go

@@ -213,7 +213,6 @@ func (c *controller) cleanupServiceBindings(cleanupNID string) {
 	for _, f := range cleanupFuncs {
 	for _, f := range cleanupFuncs {
 		f()
 		f()
 	}
 	}
-
 }
 }
 
 
 func makeServiceCleanupFunc(c *controller, s *service, nID, eID string, vip net.IP, ip net.IP) func() {
 func makeServiceCleanupFunc(c *controller, s *service, nID, eID string, vip net.IP, ip net.IP) func() {
@@ -315,7 +314,6 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
 }
 }
 
 
 func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases []string, taskAliases []string, ip net.IP, method string, deleteSvcRecords bool, fullRemove bool) error {
 func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases []string, taskAliases []string, ip net.IP, method string, deleteSvcRecords bool, fullRemove bool) error {
-
 	var rmService bool
 	var rmService bool
 
 
 	skey := serviceKey{
 	skey := serviceKey{

+ 0 - 1
libnetwork/store.go

@@ -319,7 +319,6 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
 
 
 			for _, lEp := range delEpMap {
 			for _, lEp := range delEpMap {
 				ep.getNetwork().updateSvcRecord(lEp, c.getLocalEps(nw), false)
 				ep.getNetwork().updateSvcRecord(lEp, c.getLocalEps(nw), false)
-
 			}
 			}
 			for _, lEp := range addEp {
 			for _, lEp := range addEp {
 				ep.getNetwork().updateSvcRecord(lEp, c.getLocalEps(nw), true)
 				ep.getNetwork().updateSvcRecord(lEp, c.getLocalEps(nw), true)

+ 0 - 1
libnetwork/store_linux_test.go

@@ -14,7 +14,6 @@ func TestBoltdbBackend(t *testing.T) {
 	defer os.Remove("/tmp/boltdb.db")
 	defer os.Remove("/tmp/boltdb.db")
 	config := &store.Config{Bucket: "testBackend"}
 	config := &store.Config{Bucket: "testBackend"}
 	testLocalBackend(t, "boltdb", "/tmp/boltdb.db", config)
 	testLocalBackend(t, "boltdb", "/tmp/boltdb.db", config)
-
 }
 }
 
 
 func TestNoPersist(t *testing.T) {
 func TestNoPersist(t *testing.T) {