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:
parent
091991606a
commit
4175a550fd
5 changed files with 10 additions and 8 deletions
|
@ -357,7 +357,6 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter
|
||||||
|
|
||||||
logger.Debug("createWindows() completed successfully")
|
logger.Debug("createWindows() completed successfully")
|
||||||
return ctr, nil
|
return ctr, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) extractResourcesFromSpec(spec *specs.Spec, configuration *hcsshim.ContainerConfig) {
|
func (c *client) extractResourcesFromSpec(spec *specs.Spec, configuration *hcsshim.ContainerConfig) {
|
||||||
|
|
|
@ -721,13 +721,15 @@ func (c *client) processEventStream(ctx context.Context, ns string) {
|
||||||
c.logger.WithFields(logrus.Fields{
|
c.logger.WithFields(logrus.Fields{
|
||||||
"topic": ev.Topic,
|
"topic": ev.Topic,
|
||||||
"type": reflect.TypeOf(t),
|
"type": reflect.TypeOf(t),
|
||||||
"container": t.ContainerID},
|
"container": t.ContainerID,
|
||||||
|
},
|
||||||
).Info("ignoring event")
|
).Info("ignoring event")
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
c.logger.WithFields(logrus.Fields{
|
c.logger.WithFields(logrus.Fields{
|
||||||
"topic": ev.Topic,
|
"topic": ev.Topic,
|
||||||
"type": reflect.TypeOf(t)},
|
"type": reflect.TypeOf(t),
|
||||||
|
},
|
||||||
).Info("ignoring event")
|
).Info("ignoring event")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOp
|
||||||
uid, gid := getSpecUser(ociSpec)
|
uid, gid := getSpecUser(ociSpec)
|
||||||
if uid == 0 && gid == 0 {
|
if uid == 0 && gid == 0 {
|
||||||
c.Labels[DockerContainerBundlePath] = bundleDir
|
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)
|
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 {
|
if os.IsNotExist(err) || fi.Mode()&1 == 0 {
|
||||||
p = fmt.Sprintf("%s.%d.%d", p, uid, gid)
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOp
|
||||||
c.Labels = make(map[string]string)
|
c.Labels = make(map[string]string)
|
||||||
}
|
}
|
||||||
c.Labels[DockerContainerBundlePath] = bundleDir
|
c.Labels[DockerContainerBundlePath] = bundleDir
|
||||||
return os.MkdirAll(bundleDir, 0755)
|
return os.MkdirAll(bundleDir, 0o755)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ func Start(ctx context.Context, rootDir, stateDir string, opts ...DaemonOpt) (Da
|
||||||
}
|
}
|
||||||
r.setDefaults()
|
r.setDefaults()
|
||||||
|
|
||||||
if err := system.MkdirAll(stateDir, 0700); err != nil {
|
if err := system.MkdirAll(stateDir, 0o700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ func Start(ctx context.Context, rootDir, stateDir string, opts ...DaemonOpt) (Da
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *remote) WaitTimeout(d time.Duration) error {
|
func (r *remote) WaitTimeout(d time.Duration) error {
|
||||||
timeout := time.NewTimer(d)
|
timeout := time.NewTimer(d)
|
||||||
defer timeout.Stop()
|
defer timeout.Stop()
|
||||||
|
@ -127,7 +128,7 @@ func (r *remote) Address() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *remote) getContainerdConfig() (string, error) {
|
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 {
|
if err != nil {
|
||||||
return "", errors.Wrapf(err, "failed to open containerd config file (%s)", r.configFile)
|
return "", errors.Wrapf(err, "failed to open containerd config file (%s)", r.configFile)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue