Formatting the code with https://github.com/mvdan/gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -31,7 +31,7 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s |
| 31 | 31 |
case err == nil && stat.IsDir(): |
| 32 | 32 |
err2 = fmt.Errorf("checkpoint with name %s already exists for container %s", checkpointID, ctrName)
|
| 33 | 33 |
case err != nil && os.IsNotExist(err): |
| 34 |
- err2 = os.MkdirAll(checkpointAbsDir, 0700) |
|
| 34 |
+ err2 = os.MkdirAll(checkpointAbsDir, 0o700) |
|
| 35 | 35 |
case err != nil: |
| 36 | 36 |
err2 = err |
| 37 | 37 |
default: |
| ... | ... |
@@ -111,7 +111,7 @@ func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOpt |
| 111 | 111 |
return nil, err |
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 |
- if err := os.MkdirAll(checkpointDir, 0755); err != nil {
|
|
| 114 |
+ if err := os.MkdirAll(checkpointDir, 0o755); err != nil {
|
|
| 115 | 115 |
return nil, err |
| 116 | 116 |
} |
| 117 | 117 |
|
| ... | ... |
@@ -685,7 +685,6 @@ func cleanOperationalData(es *network.EndpointSettings) {
|
| 685 | 685 |
} |
| 686 | 686 |
|
| 687 | 687 |
func (daemon *Daemon) updateNetworkConfig(container *container.Container, n libnetwork.Network, endpointConfig *networktypes.EndpointSettings, updateSettings bool) error {
|
| 688 |
- |
|
| 689 | 688 |
if containertypes.NetworkMode(n.Name()).IsUserDefined() {
|
| 690 | 689 |
addShortID := true |
| 691 | 690 |
shortID := stringid.TruncateID(container.ID) |
| ... | ... |
@@ -141,7 +141,7 @@ func (daemon *Daemon) setupIpcDirs(c *container.Container) error {
|
| 141 | 141 |
return err |
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 |
- if err := idtools.MkdirAllAndChown(shmPath, 0700, rootIDs); err != nil {
|
|
| 144 |
+ if err := idtools.MkdirAllAndChown(shmPath, 0o700, rootIDs); err != nil {
|
|
| 145 | 145 |
return err |
| 146 | 146 |
} |
| 147 | 147 |
|
| ... | ... |
@@ -196,7 +196,7 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
|
| 196 | 196 |
if err != nil {
|
| 197 | 197 |
return errors.Wrap(err, "error getting secret file path") |
| 198 | 198 |
} |
| 199 |
- if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0700, rootIDs); err != nil {
|
|
| 199 |
+ if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0o700, rootIDs); err != nil {
|
|
| 200 | 200 |
return errors.Wrap(err, "error creating secret mount path") |
| 201 | 201 |
} |
| 202 | 202 |
|
| ... | ... |
@@ -247,7 +247,7 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
|
| 247 | 247 |
if err != nil {
|
| 248 | 248 |
return errors.Wrap(err, "error getting config file path for container") |
| 249 | 249 |
} |
| 250 |
- if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0700, rootIDs); err != nil {
|
|
| 250 |
+ if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0o700, rootIDs); err != nil {
|
|
| 251 | 251 |
return errors.Wrap(err, "error creating config mount path") |
| 252 | 252 |
} |
| 253 | 253 |
|
| ... | ... |
@@ -294,7 +294,7 @@ func (daemon *Daemon) createSecretsDir(c *container.Container) error {
|
| 294 | 294 |
} |
| 295 | 295 |
|
| 296 | 296 |
// create tmpfs |
| 297 |
- if err := idtools.MkdirAllAndChown(dir, 0700, rootIDs); err != nil {
|
|
| 297 |
+ if err := idtools.MkdirAllAndChown(dir, 0o700, rootIDs); err != nil {
|
|
| 298 | 298 |
return errors.Wrap(err, "error creating secret local mount path") |
| 299 | 299 |
} |
| 300 | 300 |
|
| ... | ... |
@@ -461,5 +461,5 @@ func (daemon *Daemon) setupContainerMountsRoot(c *container.Container) error {
|
| 461 | 461 |
if err != nil {
|
| 462 | 462 |
return err |
| 463 | 463 |
} |
| 464 |
- return idtools.MkdirAllAndChown(p, 0710, idtools.Identity{UID: idtools.CurrentIdentity().UID, GID: daemon.IdentityMapping().RootPair().GID})
|
|
| 464 |
+ return idtools.MkdirAllAndChown(p, 0o710, idtools.Identity{UID: idtools.CurrentIdentity().UID, GID: daemon.IdentityMapping().RootPair().GID})
|
|
| 465 | 465 |
} |
| ... | ... |
@@ -169,7 +169,6 @@ func (daemon *Daemon) setupPathsAndSandboxOptions(container *container.Container |
| 169 | 169 |
} |
| 170 | 170 |
|
| 171 | 171 |
func (daemon *Daemon) initializeNetworkingPaths(container *container.Container, nc *container.Container) error {
|
| 172 |
- |
|
| 173 | 172 |
if nc.HostConfig.Isolation.IsHyperV() {
|
| 174 | 173 |
return fmt.Errorf("sharing of hyperv containers network is not supported")
|
| 175 | 174 |
} |
| ... | ... |
@@ -17,10 +17,10 @@ import ( |
| 17 | 17 |
) |
| 18 | 18 |
|
| 19 | 19 |
func (daemon *Daemon) configureLocalContentStore(ns string) (content.Store, leases.Manager, error) {
|
| 20 |
- if err := os.MkdirAll(filepath.Join(daemon.root, "content"), 0700); err != nil {
|
|
| 20 |
+ if err := os.MkdirAll(filepath.Join(daemon.root, "content"), 0o700); err != nil {
|
|
| 21 | 21 |
return nil, nil, errors.Wrap(err, "error creating dir for content store") |
| 22 | 22 |
} |
| 23 |
- db, err := bbolt.Open(filepath.Join(daemon.root, "content", "metadata.db"), 0600, nil) |
|
| 23 |
+ db, err := bbolt.Open(filepath.Join(daemon.root, "content", "metadata.db"), 0o600, nil) |
|
| 24 | 24 |
if err != nil {
|
| 25 | 25 |
return nil, nil, errors.Wrap(err, "error opening bolt db for content metadata store") |
| 26 | 26 |
} |
| ... | ... |
@@ -197,10 +197,10 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts |
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 | 199 |
current := idtools.CurrentIdentity() |
| 200 |
- if err := idtools.MkdirAndChown(ctr.Root, 0710, idtools.Identity{UID: current.UID, GID: daemon.IdentityMapping().RootPair().GID}); err != nil {
|
|
| 200 |
+ if err := idtools.MkdirAndChown(ctr.Root, 0o710, idtools.Identity{UID: current.UID, GID: daemon.IdentityMapping().RootPair().GID}); err != nil {
|
|
| 201 | 201 |
return nil, err |
| 202 | 202 |
} |
| 203 |
- if err := idtools.MkdirAndChown(ctr.CheckpointDir(), 0700, current); err != nil {
|
|
| 203 |
+ if err := idtools.MkdirAndChown(ctr.CheckpointDir(), 0o700, current); err != nil {
|
|
| 204 | 204 |
return nil, err |
| 205 | 205 |
} |
| 206 | 206 |
|
| ... | ... |
@@ -258,9 +258,9 @@ func TestRootMountCleanup(t *testing.T) {
|
| 258 | 258 |
cfg.ExecRoot = filepath.Join(testRoot, "exec") |
| 259 | 259 |
cfg.Root = filepath.Join(testRoot, "daemon") |
| 260 | 260 |
|
| 261 |
- err = os.Mkdir(cfg.ExecRoot, 0755) |
|
| 261 |
+ err = os.Mkdir(cfg.ExecRoot, 0o755) |
|
| 262 | 262 |
assert.NilError(t, err) |
| 263 |
- err = os.Mkdir(cfg.Root, 0755) |
|
| 263 |
+ err = os.Mkdir(cfg.Root, 0o755) |
|
| 264 | 264 |
assert.NilError(t, err) |
| 265 | 265 |
|
| 266 | 266 |
d := &Daemon{root: cfg.Root}
|
| ... | ... |
@@ -319,7 +319,7 @@ func TestRootMountCleanup(t *testing.T) {
|
| 319 | 319 |
err = mount.MakeShared(testRoot) |
| 320 | 320 |
assert.NilError(t, err) |
| 321 | 321 |
defer mount.MakePrivate(testRoot) |
| 322 |
- err = os.WriteFile(unmountFile, nil, 0644) |
|
| 322 |
+ err = os.WriteFile(unmountFile, nil, 0o644) |
|
| 323 | 323 |
assert.NilError(t, err) |
| 324 | 324 |
|
| 325 | 325 |
err = setupDaemonRootPropagation(&cfg.Config) |
| ... | ... |
@@ -150,7 +150,7 @@ func TestContainerInitDNS(t *testing.T) {
|
| 150 | 150 |
|
| 151 | 151 |
containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e" |
| 152 | 152 |
containerPath := filepath.Join(tmp, containerID) |
| 153 |
- if err := os.MkdirAll(containerPath, 0755); err != nil {
|
|
| 153 |
+ if err := os.MkdirAll(containerPath, 0o755); err != nil {
|
|
| 154 | 154 |
t.Fatal(err) |
| 155 | 155 |
} |
| 156 | 156 |
|
| ... | ... |
@@ -176,7 +176,7 @@ func TestContainerInitDNS(t *testing.T) {
|
| 176 | 176 |
if err != nil {
|
| 177 | 177 |
t.Fatal(err) |
| 178 | 178 |
} |
| 179 |
- if err = os.WriteFile(configPath, []byte(config), 0644); err != nil {
|
|
| 179 |
+ if err = os.WriteFile(configPath, []byte(config), 0o644); err != nil {
|
|
| 180 | 180 |
t.Fatal(err) |
| 181 | 181 |
} |
| 182 | 182 |
|
| ... | ... |
@@ -189,7 +189,7 @@ func TestContainerInitDNS(t *testing.T) {
|
| 189 | 189 |
if err != nil {
|
| 190 | 190 |
t.Fatal(err) |
| 191 | 191 |
} |
| 192 |
- if err = os.WriteFile(hostConfigPath, []byte(hostConfig), 0644); err != nil {
|
|
| 192 |
+ if err = os.WriteFile(hostConfigPath, []byte(hostConfig), 0o644); err != nil {
|
|
| 193 | 193 |
t.Fatal(err) |
| 194 | 194 |
} |
| 195 | 195 |
|
| ... | ... |
@@ -1213,19 +1213,19 @@ func setupDaemonRoot(config *config.Config, rootDir string, remappedRoot idtools |
| 1213 | 1213 |
// layer content subtrees. |
| 1214 | 1214 |
if _, err := os.Stat(rootDir); err == nil {
|
| 1215 | 1215 |
// root current exists; verify the access bits are correct by setting them |
| 1216 |
- if err = os.Chmod(rootDir, 0711); err != nil {
|
|
| 1216 |
+ if err = os.Chmod(rootDir, 0o711); err != nil {
|
|
| 1217 | 1217 |
return err |
| 1218 | 1218 |
} |
| 1219 | 1219 |
} else if os.IsNotExist(err) {
|
| 1220 | 1220 |
// no root exists yet, create it 0711 with root:root ownership |
| 1221 |
- if err := os.MkdirAll(rootDir, 0711); err != nil {
|
|
| 1221 |
+ if err := os.MkdirAll(rootDir, 0o711); err != nil {
|
|
| 1222 | 1222 |
return err |
| 1223 | 1223 |
} |
| 1224 | 1224 |
} |
| 1225 | 1225 |
|
| 1226 | 1226 |
id := idtools.Identity{UID: idtools.CurrentIdentity().UID, GID: remappedRoot.GID}
|
| 1227 | 1227 |
// First make sure the current root dir has the correct perms. |
| 1228 |
- if err := idtools.MkdirAllAndChown(config.Root, 0710, id); err != nil {
|
|
| 1228 |
+ if err := idtools.MkdirAllAndChown(config.Root, 0o710, id); err != nil {
|
|
| 1229 | 1229 |
return errors.Wrapf(err, "could not create or set daemon root permissions: %s", config.Root) |
| 1230 | 1230 |
} |
| 1231 | 1231 |
|
| ... | ... |
@@ -1237,7 +1237,7 @@ func setupDaemonRoot(config *config.Config, rootDir string, remappedRoot idtools |
| 1237 | 1237 |
config.Root = filepath.Join(rootDir, fmt.Sprintf("%d.%d", remappedRoot.UID, remappedRoot.GID))
|
| 1238 | 1238 |
log.G(context.TODO()).Debugf("Creating user namespaced daemon root: %s", config.Root)
|
| 1239 | 1239 |
// Create the root directory if it doesn't exist |
| 1240 |
- if err := idtools.MkdirAllAndChown(config.Root, 0710, id); err != nil {
|
|
| 1240 |
+ if err := idtools.MkdirAllAndChown(config.Root, 0o710, id); err != nil {
|
|
| 1241 | 1241 |
return fmt.Errorf("Cannot create daemon root: %s: %v", config.Root, err)
|
| 1242 | 1242 |
} |
| 1243 | 1243 |
// we also need to verify that any pre-existing directories in the path to |
| ... | ... |
@@ -1323,11 +1323,11 @@ func setupDaemonRootPropagation(cfg *config.Config) error {
|
| 1323 | 1323 |
return nil |
| 1324 | 1324 |
} |
| 1325 | 1325 |
|
| 1326 |
- if err := os.MkdirAll(filepath.Dir(cleanupFile), 0700); err != nil {
|
|
| 1326 |
+ if err := os.MkdirAll(filepath.Dir(cleanupFile), 0o700); err != nil {
|
|
| 1327 | 1327 |
return errors.Wrap(err, "error creating dir to store mount cleanup file") |
| 1328 | 1328 |
} |
| 1329 | 1329 |
|
| 1330 |
- if err := os.WriteFile(cleanupFile, nil, 0600); err != nil {
|
|
| 1330 |
+ if err := os.WriteFile(cleanupFile, nil, 0o600); err != nil {
|
|
| 1331 | 1331 |
return errors.Wrap(err, "error writing file to signal mount cleanup on shutdown") |
| 1332 | 1332 |
} |
| 1333 | 1333 |
return nil |
| ... | ... |
@@ -1446,7 +1446,7 @@ func (daemon *Daemon) initCPURtController(cfg *config.Config, mnt, path string) |
| 1446 | 1446 |
} |
| 1447 | 1447 |
|
| 1448 | 1448 |
path = filepath.Join(mnt, path) |
| 1449 |
- if err := os.MkdirAll(path, 0755); err != nil {
|
|
| 1449 |
+ if err := os.MkdirAll(path, 0o755); err != nil {
|
|
| 1450 | 1450 |
return err |
| 1451 | 1451 |
} |
| 1452 | 1452 |
if err := maybeCreateCPURealTimeFile(cfg.CPURealtimePeriod, "cpu.rt_period_us", path); err != nil {
|
| ... | ... |
@@ -1459,7 +1459,7 @@ func maybeCreateCPURealTimeFile(configValue int64, file string, path string) err |
| 1459 | 1459 |
if configValue == 0 {
|
| 1460 | 1460 |
return nil |
| 1461 | 1461 |
} |
| 1462 |
- return os.WriteFile(filepath.Join(path, file), []byte(strconv.FormatInt(configValue, 10)), 0700) |
|
| 1462 |
+ return os.WriteFile(filepath.Join(path, file), []byte(strconv.FormatInt(configValue, 10)), 0o700) |
|
| 1463 | 1463 |
} |
| 1464 | 1464 |
|
| 1465 | 1465 |
func (daemon *Daemon) setupSeccompProfile(cfg *config.Config) error {
|
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/Microsoft/hcsshim" |
| 12 | 12 |
"github.com/Microsoft/hcsshim/osversion" |
| 13 |
+ "github.com/containerd/containerd/log" |
|
| 13 | 14 |
containertypes "github.com/docker/docker/api/types/container" |
| 14 | 15 |
"github.com/docker/docker/container" |
| 15 | 16 |
"github.com/docker/docker/daemon/config" |
| ... | ... |
@@ -28,7 +29,6 @@ import ( |
| 28 | 28 |
"github.com/docker/docker/pkg/system" |
| 29 | 29 |
"github.com/docker/docker/runconfig" |
| 30 | 30 |
"github.com/pkg/errors" |
| 31 |
- "github.com/containerd/containerd/log" |
|
| 32 | 31 |
"golang.org/x/sys/windows" |
| 33 | 32 |
"golang.org/x/sys/windows/svc/mgr" |
| 34 | 33 |
) |
| ... | ... |
@@ -198,7 +198,7 @@ func checkSystem() error {
|
| 198 | 198 |
|
| 199 | 199 |
// Ensure that the required Host Network Service and vmcompute services |
| 200 | 200 |
// are running. Docker will fail in unexpected ways if this is not present. |
| 201 |
- var requiredServices = []string{"hns", "vmcompute"}
|
|
| 201 |
+ requiredServices := []string{"hns", "vmcompute"}
|
|
| 202 | 202 |
if err := ensureServicesInstalled(requiredServices); err != nil {
|
| 203 | 203 |
return errors.Wrap(err, "a required service is not installed, ensure the Containers feature is installed") |
| 204 | 204 |
} |
| ... | ... |
@@ -390,7 +390,6 @@ func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSand |
| 390 | 390 |
}), |
| 391 | 391 |
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
|
| 392 | 392 |
) |
| 393 |
- |
|
| 394 | 393 |
if err != nil {
|
| 395 | 394 |
log.G(context.TODO()).Errorf("Error occurred when creating network %v", err)
|
| 396 | 395 |
} |
| ... | ... |
@@ -482,7 +481,6 @@ func (daemon *Daemon) runAsHyperVContainer(hostConfig *containertypes.HostConfig |
| 482 | 482 |
|
| 483 | 483 |
// Container is requesting an isolation mode. Honour it. |
| 484 | 484 |
return hostConfig.Isolation.IsHyperV() |
| 485 |
- |
|
| 486 | 485 |
} |
| 487 | 486 |
|
| 488 | 487 |
// conditionalMountOnStart is a platform specific helper function during the |
| ... | ... |
@@ -116,7 +116,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, config ty |
| 116 | 116 |
// |
| 117 | 117 |
// If you arrived here and know the answer, you earned yourself a picture |
| 118 | 118 |
// of a cute animal of your own choosing. |
| 119 |
- var stopTimeout = 3 |
|
| 119 |
+ stopTimeout := 3 |
|
| 120 | 120 |
if err := daemon.containerStop(context.TODO(), container, containertypes.StopOptions{Timeout: &stopTimeout}); err != nil {
|
| 121 | 121 |
return err |
| 122 | 122 |
} |
| ... | ... |
@@ -45,7 +45,8 @@ func TestContainerDelete(t *testing.T) {
|
| 45 | 45 |
fixMsg: "Unpause and then stop the container before attempting removal or force remove", |
| 46 | 46 |
initContainer: func() *container.Container {
|
| 47 | 47 |
return newContainerWithState(&container.State{Paused: true, Running: true})
|
| 48 |
- }}, |
|
| 48 |
+ }, |
|
| 49 |
+ }, |
|
| 49 | 50 |
// a restarting container |
| 50 | 51 |
{
|
| 51 | 52 |
errMsg: "cannot remove a restarting container", |
| ... | ... |
@@ -55,14 +56,16 @@ func TestContainerDelete(t *testing.T) {
|
| 55 | 55 |
c.SetRunning(nil, nil, true) |
| 56 | 56 |
c.SetRestarting(&container.ExitStatus{})
|
| 57 | 57 |
return c |
| 58 |
- }}, |
|
| 58 |
+ }, |
|
| 59 |
+ }, |
|
| 59 | 60 |
// a running container |
| 60 | 61 |
{
|
| 61 | 62 |
errMsg: "cannot remove a running container", |
| 62 | 63 |
fixMsg: "Stop the container before attempting removal or force remove", |
| 63 | 64 |
initContainer: func() *container.Container {
|
| 64 | 65 |
return newContainerWithState(&container.State{Running: true})
|
| 65 |
- }}, |
|
| 66 |
+ }, |
|
| 67 |
+ }, |
|
| 66 | 68 |
} |
| 67 | 69 |
|
| 68 | 70 |
for _, te := range tt {
|
| ... | ... |
@@ -16,13 +16,11 @@ import ( |
| 16 | 16 |
swarmapi "github.com/moby/swarmkit/v2/api" |
| 17 | 17 |
) |
| 18 | 18 |
|
| 19 |
-var ( |
|
| 20 |
- clusterEventAction = map[swarmapi.WatchActionKind]string{
|
|
| 21 |
- swarmapi.WatchActionKindCreate: "create", |
|
| 22 |
- swarmapi.WatchActionKindUpdate: "update", |
|
| 23 |
- swarmapi.WatchActionKindRemove: "remove", |
|
| 24 |
- } |
|
| 25 |
-) |
|
| 19 |
+var clusterEventAction = map[swarmapi.WatchActionKind]string{
|
|
| 20 |
+ swarmapi.WatchActionKindCreate: "create", |
|
| 21 |
+ swarmapi.WatchActionKindUpdate: "update", |
|
| 22 |
+ swarmapi.WatchActionKindRemove: "remove", |
|
| 23 |
+} |
|
| 26 | 24 |
|
| 27 | 25 |
// LogContainerEvent generates an event related to a container with only the default attributes. |
| 28 | 26 |
func (daemon *Daemon) LogContainerEvent(container *container.Container, action string) {
|
| ... | ... |
@@ -20,7 +20,7 @@ func loadOrCreateID(idPath string) (string, error) {
|
| 20 | 20 |
idb, err := os.ReadFile(idPath) |
| 21 | 21 |
if os.IsNotExist(err) {
|
| 22 | 22 |
id = uuid.New().String() |
| 23 |
- if err := ioutils.AtomicWriteFile(idPath, []byte(id), os.FileMode(0600)); err != nil {
|
|
| 23 |
+ if err := ioutils.AtomicWriteFile(idPath, []byte(id), os.FileMode(0o600)); err != nil {
|
|
| 24 | 24 |
return "", errors.Wrap(err, "error saving ID file") |
| 25 | 25 |
} |
| 26 | 26 |
} else if err != nil {
|
| ... | ... |
@@ -42,16 +42,16 @@ func Setup(initLayerFs string, rootIdentity idtools.Identity) error {
|
| 42 | 42 |
|
| 43 | 43 |
if _, err := os.Stat(filepath.Join(initLayer, pth)); err != nil {
|
| 44 | 44 |
if os.IsNotExist(err) {
|
| 45 |
- if err := idtools.MkdirAllAndChownNew(filepath.Join(initLayer, filepath.Dir(pth)), 0755, rootIdentity); err != nil {
|
|
| 45 |
+ if err := idtools.MkdirAllAndChownNew(filepath.Join(initLayer, filepath.Dir(pth)), 0o755, rootIdentity); err != nil {
|
|
| 46 | 46 |
return err |
| 47 | 47 |
} |
| 48 | 48 |
switch typ {
|
| 49 | 49 |
case "dir": |
| 50 |
- if err := idtools.MkdirAllAndChownNew(filepath.Join(initLayer, pth), 0755, rootIdentity); err != nil {
|
|
| 50 |
+ if err := idtools.MkdirAllAndChownNew(filepath.Join(initLayer, pth), 0o755, rootIdentity); err != nil {
|
|
| 51 | 51 |
return err |
| 52 | 52 |
} |
| 53 | 53 |
case "file": |
| 54 |
- f, err := os.OpenFile(filepath.Join(initLayer, pth), os.O_CREATE, 0755) |
|
| 54 |
+ f, err := os.OpenFile(filepath.Join(initLayer, pth), os.O_CREATE, 0o755) |
|
| 55 | 55 |
if err != nil {
|
| 56 | 56 |
return err |
| 57 | 57 |
} |
| ... | ... |
@@ -330,7 +330,6 @@ func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, conf |
| 330 | 330 |
// Then walk down the graph and put the imageIds in imagesFilter |
| 331 | 331 |
return populateImageFilterByParents(ctx, imagesFilter, img.ID(), daemon.imageService.Children) |
| 332 | 332 |
}) |
| 333 |
- |
|
| 334 | 333 |
if err != nil {
|
| 335 | 334 |
return nil, err |
| 336 | 335 |
} |
| ... | ... |
@@ -40,7 +40,7 @@ func setupContainerWithName(t *testing.T, name string, daemon *Daemon) *containe |
| 40 | 40 |
computedImageID = image.ID(digest.FromString(id)) |
| 41 | 41 |
cRoot = filepath.Join(root, id) |
| 42 | 42 |
) |
| 43 |
- if err := os.MkdirAll(cRoot, 0755); err != nil {
|
|
| 43 |
+ if err := os.MkdirAll(cRoot, 0o755); err != nil {
|
|
| 44 | 44 |
t.Fatal(err) |
| 45 | 45 |
} |
| 46 | 46 |
|
| ... | ... |
@@ -1076,9 +1076,7 @@ func buildEndpointInfo(networkSettings *internalnetwork.Settings, n libnetwork.N |
| 1076 | 1076 |
} |
| 1077 | 1077 |
|
| 1078 | 1078 |
// buildJoinOptions builds endpoint Join options from a given network. |
| 1079 |
-func buildJoinOptions(networkSettings *internalnetwork.Settings, n interface {
|
|
| 1080 |
- Name() string |
|
| 1081 |
-}) ([]libnetwork.EndpointOption, error) {
|
|
| 1079 |
+func buildJoinOptions(networkSettings *internalnetwork.Settings, n interface{ Name() string }) ([]libnetwork.EndpointOption, error) {
|
|
| 1082 | 1080 |
var joinOptions []libnetwork.EndpointOption |
| 1083 | 1081 |
if epConfig, ok := networkSettings.Networks[n.Name()]; ok {
|
| 1084 | 1082 |
for _, str := range epConfig.Links {
|
| ... | ... |
@@ -24,7 +24,7 @@ func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon {
|
| 24 | 24 |
root := t.TempDir() |
| 25 | 25 |
|
| 26 | 26 |
rootfs := filepath.Join(root, "rootfs") |
| 27 |
- err := os.MkdirAll(rootfs, 0755) |
|
| 27 |
+ err := os.MkdirAll(rootfs, 0o755) |
|
| 28 | 28 |
assert.NilError(t, err) |
| 29 | 29 |
|
| 30 | 30 |
netController, err := libnetwork.New() |
| ... | ... |
@@ -219,7 +219,6 @@ func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c |
| 219 | 219 |
|
| 220 | 220 |
// Sets the Windows-specific fields of the OCI spec |
| 221 | 221 |
func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.Spec, isHyperV bool) error {
|
| 222 |
- |
|
| 223 | 222 |
s.Hostname = c.FullHostname() |
| 224 | 223 |
|
| 225 | 224 |
if len(s.Process.Cwd) == 0 {
|
| ... | ... |
@@ -70,7 +70,7 @@ func TestSetWindowsCredentialSpecInSpec(t *testing.T) {
|
| 70 | 70 |
assert.NilError(t, err) |
| 71 | 71 |
dummyCredFileName := "dummy-cred-spec.json" |
| 72 | 72 |
dummyCredFilePath := filepath.Join(credSpecsDir, dummyCredFileName) |
| 73 |
- err = os.WriteFile(dummyCredFilePath, []byte(dummyCredFileContents), 0644) |
|
| 73 |
+ err = os.WriteFile(dummyCredFilePath, []byte(dummyCredFileContents), 0o644) |
|
| 74 | 74 |
defer func() {
|
| 75 | 75 |
assert.NilError(t, os.Remove(dummyCredFilePath)) |
| 76 | 76 |
}() |
| ... | ... |
@@ -64,7 +64,8 @@ func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes. |
| 64 | 64 |
j.ImageName, |
| 65 | 65 |
fmt.Sprint(j.ProcessID), |
| 66 | 66 |
fmt.Sprintf("%02d:%02d:%02d.%03d", int(d.Hours()), int(d.Minutes())%60, int(d.Seconds())%60, int(d.Nanoseconds()/1000000)%1000),
|
| 67 |
- units.HumanSize(float64(j.MemoryWorkingSetPrivateBytes))}) |
|
| 67 |
+ units.HumanSize(float64(j.MemoryWorkingSetPrivateBytes)), |
|
| 68 |
+ }) |
|
| 68 | 69 |
} |
| 69 | 70 |
|
| 70 | 71 |
return procList, nil |