Skip to content

Commit

Permalink
Merge pull request moby#46540 from thaJeztah/24.0_backport_gofumpt_cl…
Browse files Browse the repository at this point in the history
…uster

[24.0 backport] daemon/cluster: format code with gofumpt
  • Loading branch information
vvoland authored Sep 26, 2023
2 parents 20c688f + bed0c78 commit f0808d3
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions daemon/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand All @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion daemon/cluster/controllers/plugin/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion daemon/cluster/convert/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
}

Expand Down
4 changes: 2 additions & 2 deletions daemon/cluster/convert/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion daemon/cluster/executor/container/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions daemon/cluster/executor/container/adapter_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions daemon/cluster/listen_addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion daemon/cluster/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f0808d3

Please sign in to comment.