diff --git a/libnetwork/api/api_test.go b/libnetwork/api/api_test.go index e78e7c108e..c944cc0ff7 100644 --- a/libnetwork/api/api_test.go +++ b/libnetwork/api/api_test.go @@ -2304,7 +2304,7 @@ func (nip *notimpl) NotImplemented() {} type inter struct{} func (it *inter) Error() string { - return "I am a internal error" + return "I am an internal error" } func (it *inter) Internal() {} diff --git a/libnetwork/client/network.go b/libnetwork/client/network.go index b8437b2984..1edc43086e 100644 --- a/libnetwork/client/network.go +++ b/libnetwork/client/network.go @@ -207,7 +207,7 @@ func (cli *NetworkCli) CmdNetworkInfo(chain string, args ...string) error { } // Helper function to predict if a string is a name or id or partial-id -// This provides a best-effort mechanism to identify a id with the help of GET Filter APIs +// This provides a best-effort mechanism to identify an id with the help of GET Filter APIs // Being a UI, its most likely that name will be used by the user, which is used to lookup // the corresponding ID. If ID is not found, this function will assume that the passed string // is an ID by itself. diff --git a/libnetwork/cmd/dnet/dnet.go b/libnetwork/cmd/dnet/dnet.go index 885691f009..2ee5722a0d 100644 --- a/libnetwork/cmd/dnet/dnet.go +++ b/libnetwork/cmd/dnet/dnet.go @@ -287,7 +287,7 @@ func startTestDriver() error { mux := http.NewServeMux() server := httptest.NewServer(mux) if server == nil { - return fmt.Errorf("Failed to start a HTTP Server") + return fmt.Errorf("Failed to start an HTTP Server") } mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) { diff --git a/libnetwork/datastore/datastore.go b/libnetwork/datastore/datastore.go index 49affc7883..149510dd5a 100644 --- a/libnetwork/datastore/datastore.go +++ b/libnetwork/datastore/datastore.go @@ -62,13 +62,13 @@ type datastore struct { sync.Mutex } -// KVObject is Key/Value interface used by objects to be part of the DataStore +// KVObject is Key/Value interface used by objects to be part of the DataStore type KVObject interface { - // Key method lets an object to provide the Key to be used in KV Store + // Key method lets an object provide the Key to be used in KV Store Key() []string - // KeyPrefix method lets an object to return immediate parent key that can be used for tree walk + // KeyPrefix method lets an object return immediate parent key that can be used for tree walk KeyPrefix() []string - // Value method lets an object to marshal its content to be stored in the KV store + // Value method lets an object marshal its content to be stored in the KV store Value() []byte // SetValue is used by the datastore to set the object's value when loaded from the data store. SetValue([]byte) error diff --git a/libnetwork/docs/ipam.md b/libnetwork/docs/ipam.md index 84e5b9bf79..cf3918cca9 100644 --- a/libnetwork/docs/ipam.md +++ b/libnetwork/docs/ipam.md @@ -116,7 +116,7 @@ During registration, the remote driver will receive a POST message to the URL `/ ### RequestPool -This API is for registering a address pool with the IPAM driver. Multiple identical calls must return the same result. +This API is for registering an address pool with the IPAM driver. Multiple identical calls must return the same result. It is the IPAM driver's responsibility to keep a reference count for the pool. ```go diff --git a/libnetwork/driverapi/driverapi.go b/libnetwork/driverapi/driverapi.go index f555246ceb..ccb7936e2a 100644 --- a/libnetwork/driverapi/driverapi.go +++ b/libnetwork/driverapi/driverapi.go @@ -115,7 +115,7 @@ type InterfaceNameInfo interface { // JoinInfo represents a set of resources that the driver has the ability to provide during // join time. type JoinInfo interface { - // InterfaceName returns a InterfaceNameInfo go interface to facilitate + // InterfaceName returns an InterfaceNameInfo go interface to facilitate // setting the names for the interface. InterfaceName() InterfaceNameInfo diff --git a/libnetwork/drivers/ipvlan/ipvlan_setup.go b/libnetwork/drivers/ipvlan/ipvlan_setup.go index 60d3d965ca..4269378b4a 100644 --- a/libnetwork/drivers/ipvlan/ipvlan_setup.go +++ b/libnetwork/drivers/ipvlan/ipvlan_setup.go @@ -31,7 +31,7 @@ func createIPVlan(containerIfName, parent, ipvlanMode string) (string, error) { if err != nil { return "", fmt.Errorf("error occoured looking up the %s parent iface %s error: %s", ipvlanType, parent, err) } - // Create a ipvlan link + // Create an ipvlan link ipvlan := &netlink.IPVlan{ LinkAttrs: netlink.LinkAttrs{ Name: containerIfName, diff --git a/libnetwork/drivers/ipvlan/ipvlan_setup_test.go b/libnetwork/drivers/ipvlan/ipvlan_setup_test.go index 098a6ecd73..15f9a155c7 100644 --- a/libnetwork/drivers/ipvlan/ipvlan_setup_test.go +++ b/libnetwork/drivers/ipvlan/ipvlan_setup_test.go @@ -15,7 +15,7 @@ func TestValidateLink(t *testing.T) { if ok := parentExists(validIface); !ok { t.Fatalf("failed validating loopback %s", validIface) } - // test a invalid parent interface validation + // test an invalid parent interface validation if ok := parentExists(invalidIface); ok { t.Fatalf("failed to invalidate interface %s", invalidIface) } @@ -33,17 +33,17 @@ func TestValidateSubLink(t *testing.T) { if err != nil { t.Fatalf("failed subinterface validation: %v", err) } - // test a invalid vid with a valid parent link + // test an invalid vid with a valid parent link _, _, err = parseVlan(invalidSubIface1) if err == nil { t.Fatalf("failed subinterface validation test: %s", invalidSubIface1) } - // test a valid vid with a valid parent link with a invalid delimiter + // test a valid vid with a valid parent link with an invalid delimiter _, _, err = parseVlan(invalidSubIface2) if err == nil { t.Fatalf("failed subinterface validation test: %v", invalidSubIface2) } - // test a invalid parent link with a valid vid + // test an invalid parent link with a valid vid _, _, err = parseVlan(invalidSubIface3) if err == nil { t.Fatalf("failed subinterface validation test: %v", invalidSubIface3) diff --git a/libnetwork/drivers/macvlan/macvlan_setup_test.go b/libnetwork/drivers/macvlan/macvlan_setup_test.go index 49a8780c88..796b01d376 100644 --- a/libnetwork/drivers/macvlan/macvlan_setup_test.go +++ b/libnetwork/drivers/macvlan/macvlan_setup_test.go @@ -15,7 +15,7 @@ func TestValidateLink(t *testing.T) { if ok := parentExists(validIface); !ok { t.Fatalf("failed validating loopback %s", validIface) } - // test a invalid parent interface validation + // test an invalid parent interface validation if ok := parentExists(invalidIface); ok { t.Fatalf("failed to invalidate interface %s", invalidIface) } @@ -33,17 +33,17 @@ func TestValidateSubLink(t *testing.T) { if err != nil { t.Fatalf("failed subinterface validation: %v", err) } - // test a invalid vid with a valid parent link + // test an invalid vid with a valid parent link _, _, err = parseVlan(invalidSubIface1) if err == nil { t.Fatalf("failed subinterface validation test: %s", invalidSubIface1) } - // test a valid vid with a valid parent link with a invalid delimiter + // test a valid vid with a valid parent link with an invalid delimiter _, _, err = parseVlan(invalidSubIface2) if err == nil { t.Fatalf("failed subinterface validation test: %v", invalidSubIface2) } - // test a invalid parent link with a valid vid + // test an invalid parent link with a valid vid _, _, err = parseVlan(invalidSubIface3) if err == nil { t.Fatalf("failed subinterface validation test: %v", invalidSubIface3) diff --git a/libnetwork/drivers/remote/driver_test.go b/libnetwork/drivers/remote/driver_test.go index 8d055732a4..efc82e439f 100644 --- a/libnetwork/drivers/remote/driver_test.go +++ b/libnetwork/drivers/remote/driver_test.go @@ -46,7 +46,7 @@ func setupPlugin(t *testing.T, name string, mux *http.ServeMux) func() { server := httptest.NewServer(mux) if server == nil { - t.Fatal("Failed to start a HTTP Server") + t.Fatal("Failed to start an HTTP Server") } if err := ioutil.WriteFile(fmt.Sprintf("/etc/docker/plugins/%s.spec", name), []byte(server.URL), 0644); err != nil { diff --git a/libnetwork/hostdiscovery/hostdiscovery_test.go b/libnetwork/hostdiscovery/hostdiscovery_test.go index 79fad02ae7..417e27d9a1 100644 --- a/libnetwork/hostdiscovery/hostdiscovery_test.go +++ b/libnetwork/hostdiscovery/hostdiscovery_test.go @@ -30,7 +30,7 @@ func TestDiff(t *testing.T) { updated = mapset.NewSetFromSlice([]interface{}{addedIP}) added, removed = diff(existing, updated) if len(removed) != 2 { - t.Fatalf("Diff failed for an remove update. Expecting 2 element, but got %d elements", len(removed)) + t.Fatalf("Diff failed for a remove update. Expecting 2 element, but got %d elements", len(removed)) } if len(added) != 1 { t.Fatalf("Diff failed for add use-case. Expecting 1 element, but got %d elements", len(added)) @@ -46,7 +46,7 @@ func TestAddedCallback(t *testing.T) { removed := false hd.processCallback(update, func() {}, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true }) if !added { - t.Fatalf("Expecting a Added callback notification. But none received") + t.Fatalf("Expecting an Added callback notification. But none received") } } diff --git a/libnetwork/ipamapi/contract.go b/libnetwork/ipamapi/contract.go index 513e482349..3e42f0f8cd 100644 --- a/libnetwork/ipamapi/contract.go +++ b/libnetwork/ipamapi/contract.go @@ -27,7 +27,7 @@ const ( type Callback interface { // RegisterIpamDriver provides a way for Remote drivers to dynamically register with libnetwork RegisterIpamDriver(name string, driver Ipam) error - // RegisterIpamDriverWithCapabilities provides a way for Remote drivers to dynamically register with libnetwork and specify cpaabilities + // RegisterIpamDriverWithCapabilities provides a way for Remote drivers to dynamically register with libnetwork and specify capabilities RegisterIpamDriverWithCapabilities(name string, driver Ipam, capability *Capability) error } diff --git a/libnetwork/ipams/remote/remote_test.go b/libnetwork/ipams/remote/remote_test.go index 3c6cc4bfa9..4017ad63c7 100644 --- a/libnetwork/ipams/remote/remote_test.go +++ b/libnetwork/ipams/remote/remote_test.go @@ -42,7 +42,7 @@ func setupPlugin(t *testing.T, name string, mux *http.ServeMux) func() { server := httptest.NewServer(mux) if server == nil { - t.Fatal("Failed to start a HTTP Server") + t.Fatal("Failed to start an HTTP Server") } if err := ioutil.WriteFile(fmt.Sprintf("/etc/docker/plugins/%s.spec", name), []byte(server.URL), 0644); err != nil { diff --git a/libnetwork/ipamutils/utils.go b/libnetwork/ipamutils/utils.go index 798a3afa3e..bca4e9e519 100644 --- a/libnetwork/ipamutils/utils.go +++ b/libnetwork/ipamutils/utils.go @@ -1,4 +1,4 @@ -// Package ipamutils provides utililty functions for ipam management +// Package ipamutils provides utility functions for ipam management package ipamutils import ( @@ -17,7 +17,7 @@ var ( initNetworksOnce sync.Once ) -// InitNetworks initializes the pre-defined networks used by the built-in IP allocator +// InitNetworks initializes the pre-defined networks used by the built-in IP allocator func InitNetworks() { initNetworksOnce.Do(func() { PredefinedBroadNetworks = initBroadPredefinedNetworks() diff --git a/libnetwork/ipvs/ipvs.go b/libnetwork/ipvs/ipvs.go index 8f0a0ab89a..dd0169cdc7 100644 --- a/libnetwork/ipvs/ipvs.go +++ b/libnetwork/ipvs/ipvs.go @@ -94,7 +94,7 @@ func (i *Handle) DelService(s *Service) error { return i.doCmd(s, nil, ipvsCmdDelService) } -// NewDestination creates an new real server in the passed ipvs +// NewDestination creates a new real server in the passed ipvs // service which should already be existing in the passed handle. func (i *Handle) NewDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdNewDest) diff --git a/libnetwork/libnetwork_test.go b/libnetwork/libnetwork_test.go index b63ff0f801..d17d796648 100644 --- a/libnetwork/libnetwork_test.go +++ b/libnetwork/libnetwork_test.go @@ -1115,7 +1115,7 @@ func TestEndpointJoin(t *testing.T) { } if info.Sandbox() == nil { - t.Fatalf("Expected an non-empty sandbox key for a joined endpoint. Instead found a empty sandbox key") + t.Fatalf("Expected a non-empty sandbox key for a joined endpoint. Instead found an empty sandbox key") } // Check endpoint provided container information @@ -1314,7 +1314,7 @@ func externalKeyTest(t *testing.T, reexec bool) { t.Fatalf("SetExternalKey must fail if the corresponding namespace is not created") } } else { - // Setting an non-existing key (namespace) must fail + // Setting a non-existing key (namespace) must fail if err := sbox.SetKey("this-must-fail"); err == nil { t.Fatalf("Setkey must fail if the corresponding namespace is not created") } @@ -2018,7 +2018,7 @@ func TestInvalidRemoteDriver(t *testing.T) { mux := http.NewServeMux() server := httptest.NewServer(mux) if server == nil { - t.Fatal("Failed to start a HTTP Server") + t.Fatal("Failed to start an HTTP Server") } defer server.Close() @@ -2069,7 +2069,7 @@ func TestValidRemoteDriver(t *testing.T) { mux := http.NewServeMux() server := httptest.NewServer(mux) if server == nil { - t.Fatal("Failed to start a HTTP Server") + t.Fatal("Failed to start an HTTP Server") } defer server.Close() diff --git a/libnetwork/netutils/utils.go b/libnetwork/netutils/utils.go index 62287efcc9..65449d3dee 100644 --- a/libnetwork/netutils/utils.go +++ b/libnetwork/netutils/utils.go @@ -170,7 +170,7 @@ func ReverseIP(IP string) string { return strings.Join(reverseIP, ".") } -// ParseAlias parses and validates the specified string as a alias format (name:alias) +// ParseAlias parses and validates the specified string as an alias format (name:alias) func ParseAlias(val string) (string, string, error) { if val == "" { return "", "", fmt.Errorf("empty string specified for alias") diff --git a/libnetwork/network.go b/libnetwork/network.go index 7cad9f0dc7..ea26ad88e8 100644 --- a/libnetwork/network.go +++ b/libnetwork/network.go @@ -1141,7 +1141,7 @@ func (n *network) requestPoolHelper(ipam ipamapi.Ipam, addressSpace, preferredPo } // If the network belongs to global scope or the pool was - // explicitely chosen or it is invalid, do not perform the overlap check. + // explicitly chosen or it is invalid, do not perform the overlap check. if n.Scope() == datastore.GlobalScope || preferredPool != "" || !types.IsIPNetValid(pool) { return poolID, pool, meta, nil } @@ -1165,7 +1165,7 @@ func (n *network) requestPoolHelper(ipam ipamapi.Ipam, addressSpace, preferredPo }() // If this is a preferred pool request and the network - // is local scope and there is a overlap, we fail the + // is local scope and there is an overlap, we fail the // network creation right here. The pool will be // released in the defer. if preferredPool != "" { diff --git a/libnetwork/options/options.go b/libnetwork/options/options.go index 8512ce83f3..06d8ae5902 100644 --- a/libnetwork/options/options.go +++ b/libnetwork/options/options.go @@ -41,7 +41,7 @@ func (e TypeMismatchError) Error() string { return fmt.Sprintf("type mismatch, field %s require type %v, actual type %v", e.Field, e.ExpectType, e.ActualType) } -// Generic is an basic type to store arbitrary settings. +// Generic is a basic type to store arbitrary settings. type Generic map[string]interface{} // NewGeneric returns a new Generic instance. diff --git a/libnetwork/service_linux.go b/libnetwork/service_linux.go index be163d268d..8b55eafdf5 100644 --- a/libnetwork/service_linux.go +++ b/libnetwork/service_linux.go @@ -225,7 +225,7 @@ func (n *network) rmLBBackend(ip, vip net.IP, fwMark uint32, rmService bool) { func (sb *sandbox) addLBBackend(ip, vip net.IP, fwMark uint32, addService bool) { i, err := ipvs.New(sb.Key()) if err != nil { - logrus.Errorf("Failed to create a ipvs handle for sbox %s: %v", sb.Key(), err) + logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err) return } defer i.Close() @@ -267,7 +267,7 @@ func (sb *sandbox) addLBBackend(ip, vip net.IP, fwMark uint32, addService bool) func (sb *sandbox) rmLBBackend(ip, vip net.IP, fwMark uint32, rmService bool) { i, err := ipvs.New(sb.Key()) if err != nil { - logrus.Errorf("Failed to create a ipvs handle for sbox %s: %v", sb.Key(), err) + logrus.Errorf("Failed to create an ipvs handle for sbox %s: %v", sb.Key(), err) return } defer i.Close() diff --git a/libnetwork/types/types.go b/libnetwork/types/types.go index c249d4b5bb..eedc3e4a1d 100644 --- a/libnetwork/types/types.go +++ b/libnetwork/types/types.go @@ -226,7 +226,7 @@ const ( UDP = 17 ) -// Protocol represents a IP protocol number +// Protocol represents an IP protocol number type Protocol uint8 func (p Protocol) String() string {