Ver Fonte

daemon/cluster: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn há 3 anos atrás
pai
commit
2d12dc3a58

+ 2 - 2
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{

+ 2 - 1
daemon/cluster/controllers/plugin/controller.go

@@ -66,7 +66,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) {

+ 2 - 1
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,
+			})
 		}
 	}
 

+ 2 - 2
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,

+ 1 - 1
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)

+ 1 - 2
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"

+ 1 - 0
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

+ 1 - 1
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 {