Skip to content

Commit 7bdf982

Browse files
authored
Merge pull request moby#42787 from thaJeztah/libnetwork_fix_lint
libnetwork: fix some linting issues
2 parents 175dc09 + c23eae3 commit 7bdf982

File tree

2 files changed

+24
-35
lines changed

2 files changed

+24
-35
lines changed

libnetwork/ipamapi/contract.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import (
99
"github.com/docker/docker/pkg/plugingetter"
1010
)
1111

12-
/********************
13-
* IPAM plugin types
14-
********************/
15-
12+
// IPAM plugin types
1613
const (
1714
// DefaultIPAM is the name of the built-in default ipam driver
1815
DefaultIPAM = "default"
@@ -34,10 +31,6 @@ type Callback interface {
3431
RegisterIpamDriverWithCapabilities(name string, driver Ipam, capability *Capability) error
3532
}
3633

37-
/**************
38-
* IPAM Errors
39-
**************/
40-
4134
// Well-known errors returned by IPAM
4235
var (
4336
ErrIpamInternalError = types.InternalErrorf("IPAM Internal Error")
@@ -56,10 +49,6 @@ var (
5649
ErrBadPool = types.BadRequestErrorf("Address space does not contain specified address pool")
5750
)
5851

59-
/*******************************
60-
* IPAM Service Interface
61-
*******************************/
62-
6352
// Ipam represents the interface the IPAM service plugins must implement
6453
// in order to allow injection/modification of IPAM database.
6554
type Ipam interface {
@@ -76,12 +65,12 @@ type Ipam interface {
7665
RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error)
7766
// ReleasePool releases the address pool identified by the passed id
7867
ReleasePool(poolID string) error
79-
// Request address from the specified pool ID. Input options or required IP can be passed.
68+
// RequestAddress request an address from the specified pool ID. Input options or required IP can be passed.
8069
RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error)
81-
// Release the address from the specified pool ID
70+
// ReleaseAddress releases the address from the specified pool ID.
8271
ReleaseAddress(string, net.IP) error
8372

84-
//IsBuiltIn returns true if it is a built-in driver.
73+
// IsBuiltIn returns true if it is a built-in driver.
8574
IsBuiltIn() bool
8675
}
8776

libnetwork/network.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ import (
2626
// A Network represents a logical connectivity zone that containers may
2727
// join using the Link method. A Network is managed by a specific driver.
2828
type Network interface {
29-
// A user chosen name for this network.
29+
// Name returns a user chosen name for this network.
3030
Name() string
3131

32-
// A system generated id for this network.
32+
// ID returns a system generated id for this network.
3333
ID() string
3434

35-
// The type of network, which corresponds to its managing driver.
35+
// Type returns the type of network, which corresponds to its managing driver.
3636
Type() string
3737

38-
// Create a new endpoint to this network symbolically identified by the
38+
// CreateEndpoint creates a new endpoint to this network symbolically identified by the
3939
// specified unique name. The options parameter carries driver specific options.
4040
CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)
4141

@@ -45,7 +45,7 @@ type Network interface {
4545
// Endpoints returns the list of Endpoint(s) in this network.
4646
Endpoints() []Endpoint
4747

48-
// WalkEndpoints uses the provided function to walk the Endpoints
48+
// WalkEndpoints uses the provided function to walk the Endpoints.
4949
WalkEndpoints(walker EndpointWalker)
5050

5151
// EndpointByName returns the Endpoint which has the passed name. If not found, the error ErrNoSuchEndpoint is returned.
@@ -54,7 +54,7 @@ type Network interface {
5454
// EndpointByID returns the Endpoint which has the passed id. If not found, the error ErrNoSuchEndpoint is returned.
5555
EndpointByID(id string) (Endpoint, error)
5656

57-
// Return certain operational data belonging to this network
57+
// Info returns certain operational data belonging to this network.
5858
Info() NetworkInfo
5959
}
6060

@@ -78,8 +78,8 @@ type NetworkInfo interface {
7878
// gossip cluster. For non-dynamic overlay networks and bridge networks it returns an
7979
// empty slice
8080
Peers() []networkdb.PeerInfo
81-
//Services returns a map of services keyed by the service name with the details
82-
//of all the tasks that belong to the service. Applicable only in swarm mode.
81+
// Services returns a map of services keyed by the service name with the details
82+
// of all the tasks that belong to the service. Applicable only in swarm mode.
8383
Services() map[string]ServiceInfo
8484
}
8585

@@ -89,7 +89,7 @@ type EndpointWalker func(ep Endpoint) bool
8989

9090
// ipInfo is the reverse mapping from IP to service name to serve the PTR query.
9191
// extResolver is set if an external server resolves a service name to this IP.
92-
// Its an indication to defer PTR queries also to that external server.
92+
// It's an indication to defer PTR queries also to that external server.
9393
type ipInfo struct {
9494
name string
9595
serviceID string
@@ -130,15 +130,15 @@ type networkDBTable struct {
130130

131131
// IpamConf contains all the ipam related configurations for a network
132132
type IpamConf struct {
133-
// The master address pool for containers and network interfaces
133+
// PreferredPool is the master address pool for containers and network interfaces.
134134
PreferredPool string
135-
// A subset of the master pool. If specified,
136-
// this becomes the container pool
135+
// SubPool is a subset of the master pool. If specified,
136+
// this becomes the container pool.
137137
SubPool string
138-
// Preferred Network Gateway address (optional)
138+
// Gateway is the preferred Network Gateway address (optional).
139139
Gateway string
140-
// Auxiliary addresses for network driver. Must be within the master pool.
141-
// libnetwork will reserve them if they fall into the container pool
140+
// AuxAddresses contains auxiliary addresses for network driver. Must be within the master pool.
141+
// libnetwork will reserve them if they fall into the container pool.
142142
AuxAddresses map[string]string
143143
}
144144

@@ -415,7 +415,7 @@ func (n *network) validateConfiguration() error {
415415
return nil
416416
}
417417

418-
// Applies network specific configurations
418+
// applyConfigurationTo applies network specific configurations.
419419
func (n *network) applyConfigurationTo(to *network) error {
420420
to.enableIPv6 = n.enableIPv6
421421
if len(n.labels) > 0 {
@@ -1197,12 +1197,12 @@ func (n *network) createEndpoint(name string, options ...EndpointOption) (Endpoi
11971197
}
11981198
}
11991199

1200-
ipam, cap, err := n.getController().getIPAMDriver(n.ipamType)
1200+
ipam, capability, err := n.getController().getIPAMDriver(n.ipamType)
12011201
if err != nil {
12021202
return nil, err
12031203
}
12041204

1205-
if cap.RequiresMACAddress {
1205+
if capability.RequiresMACAddress {
12061206
if ep.iface.mac == nil {
12071207
ep.iface.mac = netutils.GenerateRandomMAC()
12081208
}
@@ -2236,14 +2236,14 @@ func (n *network) deleteLoadBalancerSandbox() error {
22362236
if sb != nil {
22372237
if err := sb.DisableService(); err != nil {
22382238
logrus.Warnf("Failed to disable service on sandbox %s: %v", sandboxName, err)
2239-
//Ignore error and attempt to delete the load balancer endpoint
2239+
// Ignore error and attempt to delete the load balancer endpoint
22402240
}
22412241
}
22422242
}
22432243

22442244
if err := endpoint.Delete(true); err != nil {
22452245
logrus.Warnf("Failed to delete endpoint %s (%s) in %s: %v", endpoint.Name(), endpoint.ID(), sandboxName, err)
2246-
//Ignore error and attempt to delete the sandbox.
2246+
// Ignore error and attempt to delete the sandbox.
22472247
}
22482248
}
22492249

0 commit comments

Comments
 (0)