From 4175a550fd11b68f79c4b218f7c6f7de8446569a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 20 Jan 2022 14:11:24 +0100 Subject: [PATCH] libcontainerd: format code with gofumpt Formatting the code with https://github.com/mvdan/gofumpt Signed-off-by: Sebastiaan van Stijn --- libcontainerd/local/local_windows.go | 1 - libcontainerd/remote/client.go | 6 ++++-- libcontainerd/remote/client_linux.go | 4 ++-- libcontainerd/remote/client_windows.go | 2 +- libcontainerd/supervisor/remote_daemon.go | 5 +++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libcontainerd/local/local_windows.go b/libcontainerd/local/local_windows.go index d1dba4d5af..5d883f1c79 100644 --- a/libcontainerd/local/local_windows.go +++ b/libcontainerd/local/local_windows.go @@ -357,7 +357,6 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter logger.Debug("createWindows() completed successfully") return ctr, nil - } func (c *client) extractResourcesFromSpec(spec *specs.Spec, configuration *hcsshim.ContainerConfig) { diff --git a/libcontainerd/remote/client.go b/libcontainerd/remote/client.go index 8a6c01d8fa..cd5cf89dd0 100644 --- a/libcontainerd/remote/client.go +++ b/libcontainerd/remote/client.go @@ -721,13 +721,15 @@ func (c *client) processEventStream(ctx context.Context, ns string) { c.logger.WithFields(logrus.Fields{ "topic": ev.Topic, "type": reflect.TypeOf(t), - "container": t.ContainerID}, + "container": t.ContainerID, + }, ).Info("ignoring event") continue default: c.logger.WithFields(logrus.Fields{ "topic": ev.Topic, - "type": reflect.TypeOf(t)}, + "type": reflect.TypeOf(t), + }, ).Info("ignoring event") continue } diff --git a/libcontainerd/remote/client_linux.go b/libcontainerd/remote/client_linux.go index 8db8933376..842463ff52 100644 --- a/libcontainerd/remote/client_linux.go +++ b/libcontainerd/remote/client_linux.go @@ -60,7 +60,7 @@ func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOp uid, gid := getSpecUser(ociSpec) if uid == 0 && gid == 0 { c.Labels[DockerContainerBundlePath] = bundleDir - return idtools.MkdirAllAndChownNew(bundleDir, 0755, idtools.Identity{UID: 0, GID: 0}) + return idtools.MkdirAllAndChownNew(bundleDir, 0o755, idtools.Identity{UID: 0, GID: 0}) } p := string(filepath.Separator) @@ -73,7 +73,7 @@ func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOp } if os.IsNotExist(err) || fi.Mode()&1 == 0 { p = fmt.Sprintf("%s.%d.%d", p, uid, gid) - if err := idtools.MkdirAndChown(p, 0700, idtools.Identity{UID: uid, GID: gid}); err != nil && !os.IsExist(err) { + if err := idtools.MkdirAndChown(p, 0o700, idtools.Identity{UID: uid, GID: gid}); err != nil && !os.IsExist(err) { return err } } diff --git a/libcontainerd/remote/client_windows.go b/libcontainerd/remote/client_windows.go index 4591124430..8f3b9af294 100644 --- a/libcontainerd/remote/client_windows.go +++ b/libcontainerd/remote/client_windows.go @@ -43,7 +43,7 @@ func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOp c.Labels = make(map[string]string) } c.Labels[DockerContainerBundlePath] = bundleDir - return os.MkdirAll(bundleDir, 0755) + return os.MkdirAll(bundleDir, 0o755) } } diff --git a/libcontainerd/supervisor/remote_daemon.go b/libcontainerd/supervisor/remote_daemon.go index 761e66885c..98a8a3cb73 100644 --- a/libcontainerd/supervisor/remote_daemon.go +++ b/libcontainerd/supervisor/remote_daemon.go @@ -89,7 +89,7 @@ func Start(ctx context.Context, rootDir, stateDir string, opts ...DaemonOpt) (Da } r.setDefaults() - if err := system.MkdirAll(stateDir, 0700); err != nil { + if err := system.MkdirAll(stateDir, 0o700); err != nil { return nil, err } @@ -109,6 +109,7 @@ func Start(ctx context.Context, rootDir, stateDir string, opts ...DaemonOpt) (Da return r, nil } + func (r *remote) WaitTimeout(d time.Duration) error { timeout := time.NewTimer(d) defer timeout.Stop() @@ -127,7 +128,7 @@ func (r *remote) Address() string { } func (r *remote) getContainerdConfig() (string, error) { - f, err := os.OpenFile(r.configFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600) + f, err := os.OpenFile(r.configFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o600) if err != nil { return "", errors.Wrapf(err, "failed to open containerd config file (%s)", r.configFile) }