From 02815416bb1b084ddc0e3049fcc90739a41b0921 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 5 Jul 2023 12:13:09 +0200 Subject: [PATCH] daemon: use string-literals for easier grep'ing Signed-off-by: Sebastiaan van Stijn --- daemon/daemon_unix.go | 6 +++--- daemon/daemon_unix_test.go | 2 +- daemon/network.go | 2 +- daemon/top_unix.go | 2 +- daemon/top_unix_test.go | 4 ++-- daemon/update.go | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index 7010c9b637..856abb4a54 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -700,7 +700,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, daemonCfg *configStore, hos if hostConfig.CgroupParent != "" && UsingSystemd(&daemonCfg.Config) { // CgroupParent for systemd cgroup should be named as "xxx.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 == "" { @@ -753,7 +753,7 @@ func verifyDaemonSettings(conf *config.Config) error { } if conf.CgroupParent != "" && UsingSystemd(conf) { 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.NetworkOptionDeferIPv6Alloc(deferIPv6Alloc)) 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 } diff --git a/daemon/daemon_unix_test.go b/daemon/daemon_unix_test.go index a64bc9406d..cf0dec02f4 100644 --- a/daemon/daemon_unix_test.go +++ b/daemon/daemon_unix_test.go @@ -149,7 +149,7 @@ func TestParseSecurityOptWithDeprecatedColon(t *testing.T) { t.Fatalf("Unexpected parseSecurityOpt error: %v", err) } 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 diff --git a/daemon/network.go b/daemon/network.go index 2370496ba2..66802c3e6e 100644 --- a/daemon/network.go +++ b/daemon/network.go @@ -377,7 +377,7 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create types.NetworkCrea if err != nil { if errors.Is(err, libnetwork.ErrDataStoreNotInitialized) { //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 } diff --git a/daemon/top_unix.go b/daemon/top_unix.go index b94216a255..1d45e565dc 100644 --- a/daemon/top_unix.go +++ b/daemon/top_unix.go @@ -28,7 +28,7 @@ func validatePSArgs(psArgs string) error { k := group[1] v := group[2] 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) } } } diff --git a/daemon/top_unix_test.go b/daemon/top_unix_test.go index 0a7fd92b9c..70deee827b 100644 --- a/daemon/top_unix_test.go +++ b/daemon/top_unix_test.go @@ -11,8 +11,8 @@ import ( func TestContainerTopValidatePSArgs(t *testing.T) { tests := map[string]bool{ "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, "aeo uid=PID": true, "ae -O uid=PID": true, diff --git a/daemon/update.go b/daemon/update.go index c854f796f0..494f1603f2 100644 --- a/daemon/update.go +++ b/daemon/update.go @@ -54,7 +54,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro if ctr.RemovalInProgress || ctr.Dead { 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 {