libcontainerd: format code with gofumpt

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 14:11:24 +01:00
parent 091991606a
commit 4175a550fd
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
5 changed files with 10 additions and 8 deletions

View file

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

View file

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

View file

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

View file

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

View file

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