daemon/cluster: format code with gofumpt

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2d12dc3a58)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 13:52:02 +01:00
parent 20c688f84d
commit bed0c789dd
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
8 changed files with 12 additions and 10 deletions

View file

@ -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{

View file

@ -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) {

View file

@ -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,
})
}
}

View file

@ -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,

View file

@ -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)

View file

@ -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"

View file

@ -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

View file

@ -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 {