瀏覽代碼

daemon: use string-literals for easier grep'ing

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 年之前
父節點
當前提交
02815416bb
共有 6 個文件被更改,包括 9 次插入9 次删除
  1. 3 3
      daemon/daemon_unix.go
  2. 1 1
      daemon/daemon_unix_test.go
  3. 1 1
      daemon/network.go
  4. 1 1
      daemon/top_unix.go
  5. 2 2
      daemon/top_unix_test.go
  6. 1 1
      daemon/update.go

+ 3 - 3
daemon/daemon_unix.go

@@ -700,7 +700,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, daemonCfg *configStore, hos
 	if hostConfig.CgroupParent != "" && UsingSystemd(&daemonCfg.Config) {
 	if hostConfig.CgroupParent != "" && UsingSystemd(&daemonCfg.Config) {
 		// CgroupParent for systemd cgroup should be named as "xxx.slice"
 		// CgroupParent for systemd cgroup should be named as "xxx.slice"
 		if len(hostConfig.CgroupParent) <= 6 || !strings.HasSuffix(hostConfig.CgroupParent, ".slice") {
 		if len(hostConfig.CgroupParent) <= 6 || !strings.HasSuffix(hostConfig.CgroupParent, ".slice") {
-			return warnings, fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
+			return warnings, fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
 		}
 		}
 	}
 	}
 	if hostConfig.Runtime == "" {
 	if hostConfig.Runtime == "" {
@@ -753,7 +753,7 @@ func verifyDaemonSettings(conf *config.Config) error {
 	}
 	}
 	if conf.CgroupParent != "" && UsingSystemd(conf) {
 	if conf.CgroupParent != "" && UsingSystemd(conf) {
 		if len(conf.CgroupParent) <= 6 || !strings.HasSuffix(conf.CgroupParent, ".slice") {
 		if len(conf.CgroupParent) <= 6 || !strings.HasSuffix(conf.CgroupParent, ".slice") {
-			return fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
+			return fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
 		}
 		}
 	}
 	}
 
 
@@ -1059,7 +1059,7 @@ func initBridgeDriver(controller *libnetwork.Controller, config *config.Config)
 		libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
 		libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
 		libnetwork.NetworkOptionDeferIPv6Alloc(deferIPv6Alloc))
 		libnetwork.NetworkOptionDeferIPv6Alloc(deferIPv6Alloc))
 	if err != nil {
 	if err != nil {
-		return fmt.Errorf("Error creating default \"bridge\" network: %v", err)
+		return fmt.Errorf(`error creating default "bridge" network: %v`, err)
 	}
 	}
 	return nil
 	return nil
 }
 }

+ 1 - 1
daemon/daemon_unix_test.go

@@ -149,7 +149,7 @@ func TestParseSecurityOptWithDeprecatedColon(t *testing.T) {
 		t.Fatalf("Unexpected parseSecurityOpt error: %v", err)
 		t.Fatalf("Unexpected parseSecurityOpt error: %v", err)
 	}
 	}
 	if opts.AppArmorProfile != "test_profile" {
 	if opts.AppArmorProfile != "test_profile" {
-		t.Fatalf("Unexpected AppArmorProfile, expected: \"test_profile\", got %q", opts.AppArmorProfile)
+		t.Fatalf(`Unexpected AppArmorProfile, expected: "test_profile", got %q`, opts.AppArmorProfile)
 	}
 	}
 
 
 	// test seccomp
 	// test seccomp

+ 1 - 1
daemon/network.go

@@ -377,7 +377,7 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create types.NetworkCrea
 	if err != nil {
 	if err != nil {
 		if errors.Is(err, libnetwork.ErrDataStoreNotInitialized) {
 		if errors.Is(err, libnetwork.ErrDataStoreNotInitialized) {
 			//nolint: revive
 			//nolint: revive
-			return nil, errors.New("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.")
+			return nil, errors.New(`This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.`)
 		}
 		}
 		return nil, err
 		return nil, err
 	}
 	}

+ 1 - 1
daemon/top_unix.go

@@ -28,7 +28,7 @@ func validatePSArgs(psArgs string) error {
 			k := group[1]
 			k := group[1]
 			v := group[2]
 			v := group[2]
 			if k != "pid" {
 			if k != "pid" {
-				return fmt.Errorf("specifying \"%s=%s\" is not allowed", k, v)
+				return fmt.Errorf(`specifying "%s=%s" is not allowed`, k, v)
 			}
 			}
 		}
 		}
 	}
 	}

+ 2 - 2
daemon/top_unix_test.go

@@ -11,8 +11,8 @@ import (
 func TestContainerTopValidatePSArgs(t *testing.T) {
 func TestContainerTopValidatePSArgs(t *testing.T) {
 	tests := map[string]bool{
 	tests := map[string]bool{
 		"ae -o uid=PID":             true,
 		"ae -o uid=PID":             true,
-		"ae -o \"uid= PID\"":        true,  // ascii space (0x20)
-		"ae -o \"uid= PID\"":        false, // unicode space (U+2003, 0xe2 0x80 0x83)
+		`ae -o "uid= PID"`:          true,  // ascii space (0x20)
+		`ae -o "uid= PID"`:          false, // unicode space (U+2003, 0xe2 0x80 0x83)
 		"ae o uid=PID":              true,
 		"ae o uid=PID":              true,
 		"aeo uid=PID":               true,
 		"aeo uid=PID":               true,
 		"ae -O uid=PID":             true,
 		"ae -O uid=PID":             true,

+ 1 - 1
daemon/update.go

@@ -54,7 +54,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
 
 
 	if ctr.RemovalInProgress || ctr.Dead {
 	if ctr.RemovalInProgress || ctr.Dead {
 		ctr.Unlock()
 		ctr.Unlock()
-		return errCannotUpdate(ctr.ID, fmt.Errorf("container is marked for removal and cannot be \"update\""))
+		return errCannotUpdate(ctr.ID, fmt.Errorf(`container is marked for removal and cannot be "update"`))
 	}
 	}
 
 
 	if err := ctr.UpdateContainer(hostConfig); err != nil {
 	if err := ctr.UpdateContainer(hostConfig); err != nil {