daemon: use string-literals for easier grep'ing

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 02815416bb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-05 12:13:09 +02:00
parent a3f1f4eeb0
commit 147b87a03e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
6 changed files with 9 additions and 9 deletions

View file

@ -701,7 +701,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
if hostConfig.CgroupParent != "" && UsingSystemd(daemon.configStore) {
// 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 == "" {
@ -754,7 +754,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"`)
}
}
@ -1069,7 +1069,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
}

View file

@ -148,7 +148,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

View file

@ -375,7 +375,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string
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
}

View file

@ -29,7 +29,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)
}
}
}

View file

@ -12,8 +12,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,

View file

@ -53,7 +53,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 {