diff --git a/daemon/cluster/cluster.go b/daemon/cluster/cluster.go index 86c144e773..b4fc5bab6f 100644 --- a/daemon/cluster/cluster.go +++ b/daemon/cluster/cluster.go @@ -140,7 +140,7 @@ type attacher struct { // New creates a new Cluster instance using provided config. func New(config Config) (*Cluster, error) { root := filepath.Join(config.Root, swarmDirName) - if err := os.MkdirAll(root, 0700); err != nil { + if err := os.MkdirAll(root, 0o700); err != nil { return nil, err } if config.RuntimeRoot == "" { @@ -154,7 +154,7 @@ func New(config Config) (*Cluster, error) { config.RaftElectionTick = 10 * config.RaftHeartbeatTick } - if err := os.MkdirAll(config.RuntimeRoot, 0700); err != nil { + if err := os.MkdirAll(config.RuntimeRoot, 0o700); err != nil { return nil, err } c := &Cluster{ diff --git a/daemon/cluster/controllers/plugin/controller.go b/daemon/cluster/controllers/plugin/controller.go index b51cf86cd9..d83b3ddcff 100644 --- a/daemon/cluster/controllers/plugin/controller.go +++ b/daemon/cluster/controllers/plugin/controller.go @@ -65,7 +65,8 @@ func NewController(backend Backend, t *api.Task) (*Controller, error) { "controller": "plugin", "task": t.ID, "plugin": spec.Name, - })}, nil + }), + }, nil } func readSpec(t *api.Task) (runtime.PluginSpec, error) { diff --git a/daemon/cluster/convert/network.go b/daemon/cluster/convert/network.go index 8d733d92b7..c65a76fba5 100644 --- a/daemon/cluster/convert/network.go +++ b/daemon/cluster/convert/network.go @@ -118,7 +118,8 @@ func endpointFromGRPC(e *swarmapi.Endpoint) types.Endpoint { for _, v := range e.VirtualIPs { endpoint.VirtualIPs = append(endpoint.VirtualIPs, types.EndpointVirtualIP{ NetworkID: v.NetworkID, - Addr: v.Addr}) + Addr: v.Addr, + }) } } diff --git a/daemon/cluster/convert/node_test.go b/daemon/cluster/convert/node_test.go index 2c003851af..617c0fc4d2 100644 --- a/daemon/cluster/convert/node_test.go +++ b/daemon/cluster/convert/node_test.go @@ -15,12 +15,12 @@ func TestNodeCSIInfoFromGRPC(t *testing.T) { ID: "someID", Description: &swarmapi.NodeDescription{ CSIInfo: []*swarmapi.NodeCSIInfo{ - &swarmapi.NodeCSIInfo{ + { PluginName: "plugin1", NodeID: "p1n1", MaxVolumesPerNode: 1, }, - &swarmapi.NodeCSIInfo{ + { PluginName: "plugin2", NodeID: "p2n1", MaxVolumesPerNode: 2, diff --git a/daemon/cluster/executor/container/adapter.go b/daemon/cluster/executor/container/adapter.go index 28fcaaeb7f..d6fac0063a 100644 --- a/daemon/cluster/executor/container/adapter.go +++ b/daemon/cluster/executor/container/adapter.go @@ -412,7 +412,7 @@ func (c *containerAdapter) wait(ctx context.Context) (<-chan containerpkg.StateS } func (c *containerAdapter) shutdown(ctx context.Context) error { - var options = containertypes.StopOptions{} + options := containertypes.StopOptions{} // Default stop grace period to nil (daemon will use the stopTimeout of the container) if spec := c.container.spec(); spec.StopGracePeriod != nil { timeout := int(spec.StopGracePeriod.Seconds) diff --git a/daemon/cluster/executor/container/adapter_test.go b/daemon/cluster/executor/container/adapter_test.go index d45fc27773..c57d3bfc2a 100644 --- a/daemon/cluster/executor/container/adapter_test.go +++ b/daemon/cluster/executor/container/adapter_test.go @@ -1,9 +1,8 @@ package container // import "github.com/docker/docker/daemon/cluster/executor/container" import ( - "testing" - "context" + "testing" "time" "github.com/docker/docker/daemon" diff --git a/daemon/cluster/listen_addr.go b/daemon/cluster/listen_addr.go index 9bbf8e42a7..c8d5a0deeb 100644 --- a/daemon/cluster/listen_addr.go +++ b/daemon/cluster/listen_addr.go @@ -142,6 +142,7 @@ func getDataPathPort(portNum uint32) (uint32, error) { } return portNum, nil } + func resolveDataPathAddr(dataPathAddr string) (string, error) { if dataPathAddr == "" { // dataPathAddr is not defined diff --git a/daemon/cluster/utils.go b/daemon/cluster/utils.go index e1493de413..42b97902cf 100644 --- a/daemon/cluster/utils.go +++ b/daemon/cluster/utils.go @@ -32,7 +32,7 @@ func savePersistentState(root string, config nodeStartConfig) error { if err != nil { return err } - return ioutils.AtomicWriteFile(filepath.Join(root, stateFile), dt, 0600) + return ioutils.AtomicWriteFile(filepath.Join(root, stateFile), dt, 0o600) } func clearPersistentState(root string) error {