Browse Source

Merge pull request #45886 from thaJeztah/more_grepable

use string-literals for easier grep'ing
Bjorn Neergaard 2 năm trước cách đây
mục cha
commit
ba02bbb3b4

+ 1 - 1
builder/builder-next/controller.go

@@ -304,7 +304,7 @@ func newGraphDriverController(ctx context.Context, rt http.RoundTripper, opt Opt
 		return nil, errors.Errorf("snapshotter doesn't support differ")
 		return nil, errors.Errorf("snapshotter doesn't support differ")
 	}
 	}
 
 
-	leases, err := lm.List(ctx, "labels.\"buildkit/lease.temporary\"")
+	leases, err := lm.List(ctx, `labels."buildkit/lease.temporary"`)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 12 - 12
builder/dockerfile/copy_test.go

@@ -53,31 +53,31 @@ func TestGetFilenameForDownload(t *testing.T) {
 		expected    string
 		expected    string
 	}{
 	}{
 		{
 		{
-			path:     "http://www.example.com/",
+			path:     "https://www.example.com/",
 			expected: "",
 			expected: "",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz",
+			path:     "https://www.example.com/xyz",
 			expected: "xyz",
 			expected: "xyz",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz.html",
+			path:     "https://www.example.com/xyz.html",
 			expected: "xyz.html",
 			expected: "xyz.html",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz/",
+			path:     "https://www.example.com/xyz/",
 			expected: "",
 			expected: "",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz/uvw",
+			path:     "https://www.example.com/xyz/uvw",
 			expected: "uvw",
 			expected: "uvw",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz/uvw.html",
+			path:     "https://www.example.com/xyz/uvw.html",
 			expected: "uvw.html",
 			expected: "uvw.html",
 		},
 		},
 		{
 		{
-			path:     "http://www.example.com/xyz/uvw/",
+			path:     "https://www.example.com/xyz/uvw/",
 			expected: "",
 			expected: "",
 		},
 		},
 		{
 		{
@@ -114,23 +114,23 @@ func TestGetFilenameForDownload(t *testing.T) {
 			expected:    "xyz.html",
 			expected:    "xyz.html",
 		},
 		},
 		{
 		{
-			disposition: "attachment; filename=\"xyz\"",
+			disposition: `attachment; filename="xyz"`,
 			expected:    "xyz",
 			expected:    "xyz",
 		},
 		},
 		{
 		{
-			disposition: "attachment; filename=\"xyz.html\"",
+			disposition: `attachment; filename="xyz.html"`,
 			expected:    "xyz.html",
 			expected:    "xyz.html",
 		},
 		},
 		{
 		{
-			disposition: "attachment; filename=\"/xyz.html\"",
+			disposition: `attachment; filename="/xyz.html"`,
 			expected:    "xyz.html",
 			expected:    "xyz.html",
 		},
 		},
 		{
 		{
-			disposition: "attachment; filename=\"/xyz/uvw\"",
+			disposition: `attachment; filename="/xyz/uvw"`,
 			expected:    "uvw",
 			expected:    "uvw",
 		},
 		},
 		{
 		{
-			disposition: "attachment; filename=\"Naïve file.txt\"",
+			disposition: `attachment; filename="Naïve file.txt"`,
 			expected:    "Naïve file.txt",
 			expected:    "Naïve file.txt",
 		},
 		},
 	}
 	}

+ 2 - 2
builder/dockerfile/copy_windows.go

@@ -15,8 +15,8 @@ import (
 )
 )
 
 
 var pathDenyList = map[string]bool{
 var pathDenyList = map[string]bool{
-	"c:\\":        true,
-	"c:\\windows": true,
+	`c:\`:        true,
+	`c:\windows`: true,
 }
 }
 
 
 func init() {
 func init() {

+ 4 - 4
cli/debug/debug_test.go

@@ -14,20 +14,20 @@ func TestEnable(t *testing.T) {
 	}()
 	}()
 	Enable()
 	Enable()
 	if os.Getenv("DEBUG") != "1" {
 	if os.Getenv("DEBUG") != "1" {
-		t.Fatalf("expected DEBUG=1, got %s\n", os.Getenv("DEBUG"))
+		t.Fatalf("expected DEBUG=1, got %s", os.Getenv("DEBUG"))
 	}
 	}
 	if logrus.GetLevel() != logrus.DebugLevel {
 	if logrus.GetLevel() != logrus.DebugLevel {
-		t.Fatalf("expected log level %v, got %v\n", logrus.DebugLevel, logrus.GetLevel())
+		t.Fatalf("expected log level %v, got %v", logrus.DebugLevel, logrus.GetLevel())
 	}
 	}
 }
 }
 
 
 func TestDisable(t *testing.T) {
 func TestDisable(t *testing.T) {
 	Disable()
 	Disable()
 	if os.Getenv("DEBUG") != "" {
 	if os.Getenv("DEBUG") != "" {
-		t.Fatalf("expected DEBUG=\"\", got %s\n", os.Getenv("DEBUG"))
+		t.Fatalf(`expected DEBUG="", got %s`, os.Getenv("DEBUG"))
 	}
 	}
 	if logrus.GetLevel() != logrus.InfoLevel {
 	if logrus.GetLevel() != logrus.InfoLevel {
-		t.Fatalf("expected log level %v, got %v\n", logrus.InfoLevel, logrus.GetLevel())
+		t.Fatalf("expected log level %v, got %v", logrus.InfoLevel, logrus.GetLevel())
 	}
 	}
 }
 }
 
 

+ 1 - 1
client/image_tag_test.go

@@ -42,7 +42,7 @@ func TestImageTagInvalidSourceImageName(t *testing.T) {
 	}
 	}
 
 
 	err := client.ImageTag(context.Background(), "invalid_source_image_name_", "repo:tag")
 	err := client.ImageTag(context.Background(), "invalid_source_image_name_", "repo:tag")
-	if err == nil || err.Error() != "Error parsing reference: \"invalid_source_image_name_\" is not a valid repository/tag: invalid reference format" {
+	if err == nil || err.Error() != `Error parsing reference: "invalid_source_image_name_" is not a valid repository/tag: invalid reference format` {
 		t.Fatalf("expected Parsing Reference Error, got %v", err)
 		t.Fatalf("expected Parsing Reference Error, got %v", err)
 	}
 	}
 }
 }

+ 1 - 1
daemon/cluster/cluster.go

@@ -359,7 +359,7 @@ func (c *Cluster) errNoManager(st nodeState) error {
 		if st.err == errSwarmCertificatesExpired {
 		if st.err == errSwarmCertificatesExpired {
 			return errSwarmCertificatesExpired
 			return errSwarmCertificatesExpired
 		}
 		}
-		return errors.WithStack(notAvailableError("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 errors.WithStack(notAvailableError(`This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.`))
 	}
 	}
 	if st.swarmNode.Manager() != nil {
 	if st.swarmNode.Manager() != nil {
 		return errors.WithStack(notAvailableError("This node is not a swarm manager. Manager is being prepared or has trouble connecting to the cluster."))
 		return errors.WithStack(notAvailableError("This node is not a swarm manager. Manager is being prepared or has trouble connecting to the cluster."))

+ 3 - 3
daemon/cluster/errors.go

@@ -5,13 +5,13 @@ const (
 	errNoSwarm notAvailableError = "This node is not part of a swarm"
 	errNoSwarm notAvailableError = "This node is not part of a swarm"
 
 
 	// errSwarmExists is returned on initialize or join request for a cluster that has already been activated
 	// errSwarmExists is returned on initialize or join request for a cluster that has already been activated
-	errSwarmExists notAvailableError = "This node is already part of a swarm. Use \"docker swarm leave\" to leave this swarm and join another one."
+	errSwarmExists notAvailableError = `This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.`
 
 
 	// errSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
 	// errSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
-	errSwarmJoinTimeoutReached notAvailableError = "Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the \"docker info\" command to see the current swarm status of your node."
+	errSwarmJoinTimeoutReached notAvailableError = `Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.`
 
 
 	// errSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
 	// errSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
-	errSwarmLocked notAvailableError = "Swarm is encrypted and needs to be unlocked before it can be used. Please use \"docker swarm unlock\" to unlock it."
+	errSwarmLocked notAvailableError = `Swarm is encrypted and needs to be unlocked before it can be used. Please use "docker swarm unlock" to unlock it.`
 
 
 	// errSwarmCertificatesExpired is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
 	// errSwarmCertificatesExpired is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
 	errSwarmCertificatesExpired notAvailableError = "Swarm certificates have expired. To replace them, leave the swarm and join again."
 	errSwarmCertificatesExpired notAvailableError = "Swarm certificates have expired. To replace them, leave the swarm and join again."

+ 1 - 1
daemon/cluster/services.go

@@ -456,7 +456,7 @@ func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector
 	} else {
 	} else {
 		t, err := strconv.Atoi(config.Tail)
 		t, err := strconv.Atoi(config.Tail)
 		if err != nil {
 		if err != nil {
-			return nil, errors.New("tail value must be a positive integer or \"all\"")
+			return nil, errors.New(`tail value must be a positive integer or "all"`)
 		}
 		}
 		if t < 0 {
 		if t < 0 {
 			return nil, errors.New("negative tail values not supported")
 			return nil, errors.New("negative tail values not supported")

+ 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 {

+ 1 - 1
integration-cli/check_test.go

@@ -76,7 +76,7 @@ func printCliVersion() {
 	cli.SetTestEnvironment(testEnv)
 	cli.SetTestEnvironment(testEnv)
 	cmd := cli.Docker(cli.Args("version"))
 	cmd := cli.Docker(cli.Args("version"))
 	if cmd.Error != nil {
 	if cmd.Error != nil {
-		fmt.Printf("WARNING: Failed to run \"docker version\": %+v\n", cmd.Error)
+		fmt.Printf("WARNING: Failed to run 'docker version': %+v\n", cmd.Error)
 		return
 		return
 	}
 	}
 
 

+ 1 - 1
integration-cli/docker_api_containers_test.go

@@ -1158,7 +1158,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
 	assert.Assert(c, waitRun(id2) == nil)
 	assert.Assert(c, waitRun(id2) == nil)
 
 
 	links := inspectFieldJSON(c, id2, "HostConfig.Links")
 	links := inspectFieldJSON(c, id2, "HostConfig.Links")
-	assert.Equal(c, links, "[\"/tlink1:/tlink2/tlink1\"]", "expected to have links between containers")
+	assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
 
 
 	removeOptions := types.ContainerRemoveOptions{
 	removeOptions := types.ContainerRemoveOptions{
 		RemoveLinks: true,
 		RemoveLinks: true,

+ 2 - 2
integration-cli/docker_cli_build_test.go

@@ -2258,7 +2258,7 @@ docker.com>"
   `))
   `))
 
 
 	res := inspectField(c, name, "Author")
 	res := inspectField(c, name, "Author")
-	if res != "\"Docker IO <io@docker.com>\"" {
+	if res != `"Docker IO <io@docker.com>"` {
 		c.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
 		c.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
 	}
 	}
 }
 }
@@ -2272,7 +2272,7 @@ func (s *DockerCLIBuildSuite) TestBuildVerifyIntString(c *testing.T) {
 	MAINTAINER 123`))
 	MAINTAINER 123`))
 
 
 	out, _ := dockerCmd(c, "inspect", name)
 	out, _ := dockerCmd(c, "inspect", name)
-	if !strings.Contains(out, "\"123\"") {
+	if !strings.Contains(out, `"123"`) {
 		c.Fatalf("Output does not contain the int as a string:\n%s", out)
 		c.Fatalf("Output does not contain the int as a string:\n%s", out)
 	}
 	}
 }
 }

+ 11 - 11
integration-cli/docker_cli_commit_test.go

@@ -120,17 +120,17 @@ func (s *DockerCLICommitSuite) TestCommitChange(c *testing.T) {
 	dockerCmd(c, "run", "--name", "test", "busybox", "true")
 	dockerCmd(c, "run", "--name", "test", "busybox", "true")
 
 
 	imageID, _ := dockerCmd(c, "commit",
 	imageID, _ := dockerCmd(c, "commit",
-		"--change", "EXPOSE 8080",
-		"--change", "ENV DEBUG true",
-		"--change", "ENV test 1",
-		"--change", "ENV PATH /foo",
-		"--change", "LABEL foo bar",
-		"--change", "CMD [\"/bin/sh\"]",
-		"--change", "WORKDIR /opt",
-		"--change", "ENTRYPOINT [\"/bin/sh\"]",
-		"--change", "USER testuser",
-		"--change", "VOLUME /var/lib/docker",
-		"--change", "ONBUILD /usr/local/bin/python-build --dir /app/src",
+		"--change", `EXPOSE 8080`,
+		"--change", `ENV DEBUG true`,
+		"--change", `ENV test 1`,
+		"--change", `ENV PATH /foo`,
+		"--change", `LABEL foo bar`,
+		"--change", `CMD ["/bin/sh"]`,
+		"--change", `WORKDIR /opt`,
+		"--change", `ENTRYPOINT ["/bin/sh"]`,
+		"--change", `USER testuser`,
+		"--change", `VOLUME /var/lib/docker`,
+		"--change", `ONBUILD /usr/local/bin/python-build --dir /app/src`,
 		"test", "test-commit")
 		"test", "test-commit")
 	imageID = strings.TrimSpace(imageID)
 	imageID = strings.TrimSpace(imageID)
 
 

+ 2 - 2
integration-cli/docker_cli_events_test.go

@@ -750,7 +750,7 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadFunc(c *testing.T) {
 	result.Assert(c, icmd.Expected{
 	result.Assert(c, icmd.Expected{
 		Error:    "exit status 64",
 		Error:    "exit status 64",
 		ExitCode: 64,
 		ExitCode: 64,
-		Err:      "Error parsing format: template: :1: function \"badFuncString\" not defined",
+		Err:      `Error parsing format: template: :1: function "badFuncString" not defined`,
 	})
 	})
 }
 }
 
 
@@ -760,6 +760,6 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadField(c *testing.T) {
 	result.Assert(c, icmd.Expected{
 	result.Assert(c, icmd.Expected{
 		Error:    "exit status 64",
 		Error:    "exit status 64",
 		ExitCode: 64,
 		ExitCode: 64,
-		Err:      "Error parsing format: template: :1:2: executing \"\" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message",
+		Err:      `Error parsing format: template: :1:2: executing "" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message`,
 	})
 	})
 }
 }

+ 15 - 15
integration-cli/docker_cli_events_unix_test.go

@@ -414,21 +414,21 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
 	// only check for values known (daemon ID/name) or explicitly set above,
 	// only check for values known (daemon ID/name) or explicitly set above,
 	// otherwise just check for names being present.
 	// otherwise just check for names being present.
 	expectedSubstrings := []string{
 	expectedSubstrings := []string{
-		" daemon reload " + info.ID + " ",
-		"(allow-nondistributable-artifacts=[",
-		" debug=true, ",
-		" default-ipc-mode=",
-		" default-runtime=",
-		" default-shm-size=",
-		" insecure-registries=[",
-		" labels=[\"bar=foo\"], ",
-		" live-restore=",
-		" max-concurrent-downloads=1, ",
-		" max-concurrent-uploads=5, ",
-		" name=" + info.Name,
-		" registry-mirrors=[",
-		" runtimes=",
-		" shutdown-timeout=10)",
+		` daemon reload ` + info.ID + " ",
+		`(allow-nondistributable-artifacts=[`,
+		` debug=true, `,
+		` default-ipc-mode=`,
+		` default-runtime=`,
+		` default-shm-size=`,
+		` insecure-registries=[`,
+		` labels=["bar=foo"], `,
+		` live-restore=`,
+		` max-concurrent-downloads=1, `,
+		` max-concurrent-uploads=5, `,
+		` name=` + info.Name,
+		` registry-mirrors=[`,
+		` runtimes=`,
+		` shutdown-timeout=10)`,
 	}
 	}
 
 
 	for _, s := range expectedSubstrings {
 	for _, s := range expectedSubstrings {

+ 1 - 1
integration-cli/docker_cli_links_test.go

@@ -218,7 +218,7 @@ func (s *DockerCLILinksSuite) TestLinkShortDefinition(c *testing.T) {
 	assert.Assert(c, waitRun(cid2) == nil)
 	assert.Assert(c, waitRun(cid2) == nil)
 
 
 	links := inspectFieldJSON(c, cid2, "HostConfig.Links")
 	links := inspectFieldJSON(c, cid2, "HostConfig.Links")
-	assert.Equal(c, links, "[\"/shortlinkdef:/link2/shortlinkdef\"]")
+	assert.Equal(c, links, `["/shortlinkdef:/link2/shortlinkdef"]`)
 }
 }
 
 
 func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {
 func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {

+ 3 - 3
integration-cli/docker_cli_ps_test.go

@@ -176,7 +176,7 @@ func (s *DockerCLIPsSuite) TestPsListContainersSize(c *testing.T) {
 	select {
 	select {
 	case <-wait:
 	case <-wait:
 	case <-time.After(3 * time.Second):
 	case <-time.After(3 * time.Second):
-		c.Fatalf("Calling \"docker ps -s\" timed out!")
+		c.Fatalf(`Calling "docker ps -s" timed out!`)
 	}
 	}
 	result.Assert(c, icmd.Success)
 	result.Assert(c, icmd.Success)
 	lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
 	lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
@@ -634,8 +634,8 @@ func (s *DockerCLIPsSuite) TestPsShowMounts(c *testing.T) {
 	var bindMountSource string
 	var bindMountSource string
 	var bindMountDestination string
 	var bindMountDestination string
 	if DaemonIsWindows() {
 	if DaemonIsWindows() {
-		bindMountSource = "c:\\"
-		bindMountDestination = "c:\\t"
+		bindMountSource = `c:\`
+		bindMountDestination = `c:\t`
 	} else {
 	} else {
 		bindMountSource = "/tmp"
 		bindMountSource = "/tmp"
 		bindMountDestination = "/t"
 		bindMountDestination = "/t"

+ 2 - 2
integration-cli/docker_cli_pull_local_test.go

@@ -391,7 +391,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
 
 
 	b, err := os.ReadFile(configPath)
 	b, err := os.ReadFile(configPath)
 	assert.NilError(c, err)
 	assert.NilError(c, err)
-	assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
+	assert.Assert(c, !strings.Contains(string(b), `"auth":`))
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
 	dockerCmd(c, "--config", tmp, "push", repoName)
 	dockerCmd(c, "--config", tmp, "push", repoName)
 
 
@@ -433,7 +433,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *testing.T)
 
 
 	b, err := os.ReadFile(configPath)
 	b, err := os.ReadFile(configPath)
 	assert.NilError(c, err)
 	assert.NilError(c, err)
-	assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
+	assert.Assert(c, !strings.Contains(string(b), `"auth":`))
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
 	dockerCmd(c, "--config", tmp, "push", repoName)
 	dockerCmd(c, "--config", tmp, "push", repoName)
 
 

+ 2 - 2
integration-cli/docker_cli_run_test.go

@@ -1673,7 +1673,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeUIDGID(c *testing.T) {
 		RUN mkdir -p /hello && touch /hello/test && chown dockerio.dockerio /hello`))
 		RUN mkdir -p /hello && touch /hello/test && chown dockerio.dockerio /hello`))
 
 
 	// Test that the uid and gid is copied from the image to the volume
 	// Test that the uid and gid is copied from the image to the volume
-	out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", "ls -l / | grep hello | awk '{print $3\":\"$4}'")
+	out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", `ls -l / | grep hello | awk '{print $3":"$4}'`)
 	out = strings.TrimSpace(out)
 	out = strings.TrimSpace(out)
 	if out != "dockerio:dockerio" {
 	if out != "dockerio:dockerio" {
 		c.Fatalf("Wrong /hello ownership: %s, expected dockerio:dockerio", out)
 		c.Fatalf("Wrong /hello ownership: %s, expected dockerio:dockerio", out)
@@ -2053,7 +2053,7 @@ func (s *DockerCLIRunSuite) TestRunPortInUse(c *testing.T) {
 		c.Fatalf("Binding on used port must fail")
 		c.Fatalf("Binding on used port must fail")
 	}
 	}
 	if !strings.Contains(out, "port is already allocated") {
 	if !strings.Contains(out, "port is already allocated") {
-		c.Fatalf("Out must be about \"port is already allocated\", got %s", out)
+		c.Fatalf(`Out must be about "port is already allocated", got %s`, out)
 	}
 	}
 }
 }
 
 

+ 2 - 2
integration-cli/docker_cli_service_logs_test.go

@@ -229,7 +229,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *testing.T) {
 	assert.Assert(c, id != "")
 	assert.Assert(c, id != "")
 	// so, right here, we're basically inspecting by id and returning only
 	// so, right here, we're basically inspecting by id and returning only
 	// the ID. if they don't match, the service doesn't exist.
 	// the ID. if they don't match, the service doesn't exist.
-	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
+	result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
 	result.Assert(c, icmd.Expected{Out: id})
 	result.Assert(c, icmd.Expected{Out: id})
 
 
 	// make sure task has been deployed.
 	// make sure task has been deployed.
@@ -282,7 +282,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *testing.T) {
 	assert.Assert(c, id != "")
 	assert.Assert(c, id != "")
 	// so, right here, we're basically inspecting by id and returning only
 	// so, right here, we're basically inspecting by id and returning only
 	// the ID. if they don't match, the service doesn't exist.
 	// the ID. if they don't match, the service doesn't exist.
-	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
+	result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
 	result.Assert(c, icmd.Expected{Out: id})
 	result.Assert(c, icmd.Expected{Out: id})
 
 
 	// make sure task has been deployed.
 	// make sure task has been deployed.

+ 4 - 3
integration/config/config_test.go

@@ -251,9 +251,10 @@ func TestTemplatedConfig(t *testing.T) {
 		Templating: &swarmtypes.Driver{
 		Templating: &swarmtypes.Driver{
 			Name: "golang",
 			Name: "golang",
 		},
 		},
-		Data: []byte("SERVICE_NAME={{.Service.Name}}\n" +
-			"{{secret \"referencedsecrettarget\"}}\n" +
-			"{{config \"referencedconfigtarget\"}}\n"),
+		Data: []byte(`SERVICE_NAME={{.Service.Name}}
+{{secret "referencedsecrettarget"}}
+{{config "referencedconfigtarget"}}
+`),
 	}
 	}
 
 
 	templatedConfig, err := c.ConfigCreate(ctx, configSpec)
 	templatedConfig, err := c.ConfigCreate(ctx, configSpec)

+ 1 - 1
libnetwork/store_linux_test.go

@@ -26,7 +26,7 @@ func TestNoPersist(t *testing.T) {
 	defer testController.Stop()
 	defer testController.Stop()
 	nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
 	nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
 	if err != nil {
 	if err != nil {
-		t.Fatalf("Error creating default \"host\" network: %v", err)
+		t.Fatalf(`Error creating default "host" network: %v`, err)
 	}
 	}
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
 	if err != nil {
 	if err != nil {

+ 1 - 1
libnetwork/store_test.go

@@ -30,7 +30,7 @@ func testLocalBackend(t *testing.T, provider, url string, storeConfig *store.Con
 	defer testController.Stop()
 	defer testController.Stop()
 	nw, err := testController.NewNetwork("host", "host", "")
 	nw, err := testController.NewNetwork("host", "host", "")
 	if err != nil {
 	if err != nil {
-		t.Fatalf("Error creating default \"host\" network: %v", err)
+		t.Fatalf(`Error creating default "host" network: %v`, err)
 	}
 	}
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
 	if err != nil {
 	if err != nil {

+ 5 - 5
opts/opts_test.go

@@ -71,10 +71,10 @@ func TestListOptsWithoutValidator(t *testing.T) {
 		t.Errorf("%d != 3", o.Len())
 		t.Errorf("%d != 3", o.Len())
 	}
 	}
 	if !o.Get("bar") {
 	if !o.Get("bar") {
-		t.Error("o.Get(\"bar\") == false")
+		t.Error(`o.Get("bar") == false`)
 	}
 	}
 	if o.Get("baz") {
 	if o.Get("baz") {
-		t.Error("o.Get(\"baz\") == true")
+		t.Error(`o.Get("baz") == true`)
 	}
 	}
 	o.Delete("foo")
 	o.Delete("foo")
 	if o.String() != "[bar bar]" {
 	if o.String() != "[bar bar]" {
@@ -106,10 +106,10 @@ func TestListOptsWithValidator(t *testing.T) {
 		t.Errorf("%d != 1", o.Len())
 		t.Errorf("%d != 1", o.Len())
 	}
 	}
 	if !o.Get("max-file=2") {
 	if !o.Get("max-file=2") {
-		t.Error("o.Get(\"max-file=2\") == false")
+		t.Error(`o.Get("max-file=2") == false`)
 	}
 	}
 	if o.Get("baz") {
 	if o.Get("baz") {
-		t.Error("o.Get(\"baz\") == true")
+		t.Error(`o.Get("baz") == true`)
 	}
 	}
 	o.Delete("max-file=2")
 	o.Delete("max-file=2")
 	if o.String() != "" {
 	if o.String() != "" {
@@ -361,7 +361,7 @@ func TestMapMapOpts(t *testing.T) {
 	o.Set("r1=k12=v12")
 	o.Set("r1=k12=v12")
 	assert.Check(t, is.DeepEqual(tmpMap["r1"], map[string]string{"k11": "v11", "k12": "v12"}))
 	assert.Check(t, is.DeepEqual(tmpMap["r1"], map[string]string{"k11": "v11", "k12": "v12"}))
 
 
-	if o.Set("invalid-key={\"k\":\"v\"}") == nil {
+	if o.Set(`invalid-key={"k":"v"}`) == nil {
 		t.Error("validator is not being called")
 		t.Error("validator is not being called")
 	}
 	}
 }
 }

+ 2 - 2
pkg/idtools/idtools_unix_test.go

@@ -458,14 +458,14 @@ func TestLookupUserAndGroup(t *testing.T) {
 func TestLookupUserAndGroupThatDoesNotExist(t *testing.T) {
 func TestLookupUserAndGroupThatDoesNotExist(t *testing.T) {
 	fakeUser := "fakeuser"
 	fakeUser := "fakeuser"
 	_, err := LookupUser(fakeUser)
 	_, err := LookupUser(fakeUser)
-	assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeUser+"\" in passwd database"))
+	assert.Check(t, is.Error(err, `getent unable to find entry "fakeuser" in passwd database`))
 
 
 	_, err = LookupUID(-1)
 	_, err = LookupUID(-1)
 	assert.Check(t, is.ErrorContains(err, ""))
 	assert.Check(t, is.ErrorContains(err, ""))
 
 
 	fakeGroup := "fakegroup"
 	fakeGroup := "fakegroup"
 	_, err = LookupGroup(fakeGroup)
 	_, err = LookupGroup(fakeGroup)
-	assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeGroup+"\" in group database"))
+	assert.Check(t, is.Error(err, `getent unable to find entry "fakegroup" in group database`))
 
 
 	_, err = LookupGID(-1)
 	_, err = LookupGID(-1)
 	assert.Check(t, is.ErrorContains(err, ""))
 	assert.Check(t, is.ErrorContains(err, ""))

+ 6 - 6
pkg/ioutils/buffer_test.go

@@ -66,7 +66,7 @@ func TestFixedBufferString(t *testing.T) {
 
 
 	out := buf.String()
 	out := buf.String()
 	if out != "helloworld" {
 	if out != "helloworld" {
-		t.Fatalf("expected output to be \"helloworld\", got %q", out)
+		t.Fatalf(`expected output to be "helloworld", got %q`, out)
 	}
 	}
 
 
 	// read 5 bytes
 	// read 5 bytes
@@ -76,7 +76,7 @@ func TestFixedBufferString(t *testing.T) {
 	// test that fixedBuffer.String() only returns the part that hasn't been read
 	// test that fixedBuffer.String() only returns the part that hasn't been read
 	out = buf.String()
 	out = buf.String()
 	if out != "world" {
 	if out != "world" {
-		t.Fatalf("expected output to be \"world\", got %q", out)
+		t.Fatalf(`expected output to be "world", got %q`, out)
 	}
 	}
 }
 }
 
 
@@ -92,7 +92,7 @@ func TestFixedBufferWrite(t *testing.T) {
 	}
 	}
 
 
 	if string(buf.buf[:5]) != "hello" {
 	if string(buf.buf[:5]) != "hello" {
-		t.Fatalf("expected \"hello\", got %q", string(buf.buf[:5]))
+		t.Fatalf(`expected "hello", got %q`, string(buf.buf[:5]))
 	}
 	}
 
 
 	n, err = buf.Write(bytes.Repeat([]byte{1}, 64))
 	n, err = buf.Write(bytes.Repeat([]byte{1}, 64))
@@ -121,7 +121,7 @@ func TestFixedBufferRead(t *testing.T) {
 	}
 	}
 
 
 	if string(b) != "hello" {
 	if string(b) != "hello" {
-		t.Fatalf("expected \"hello\", got %q", string(b))
+		t.Fatalf(`expected "hello", got %q`, string(b))
 	}
 	}
 
 
 	n, err = buf.Read(b)
 	n, err = buf.Read(b)
@@ -134,7 +134,7 @@ func TestFixedBufferRead(t *testing.T) {
 	}
 	}
 
 
 	if string(b) != " worl" {
 	if string(b) != " worl" {
-		t.Fatalf("expected \" worl\", got %s", string(b))
+		t.Fatalf(`expected " worl", got %s`, string(b))
 	}
 	}
 
 
 	b = b[:1]
 	b = b[:1]
@@ -148,6 +148,6 @@ func TestFixedBufferRead(t *testing.T) {
 	}
 	}
 
 
 	if string(b) != "d" {
 	if string(b) != "d" {
-		t.Fatalf("expected \"d\", got %s", string(b))
+		t.Fatalf(`expected "d", got %s`, string(b))
 	}
 	}
 }
 }

+ 4 - 4
pkg/jsonmessage/jsonmessage_test.go

@@ -241,22 +241,22 @@ func TestDisplayJSONMessagesStream(t *testing.T) {
 			"",
 			"",
 		},
 		},
 		// Without progress & ID
 		// Without progress & ID
-		"{ \"status\": \"status\" }": {
+		`{ "status": "status" }`: {
 			"status\n",
 			"status\n",
 			"status\n",
 			"status\n",
 		},
 		},
 		// Without progress, with ID
 		// Without progress, with ID
-		"{ \"id\": \"ID\",\"status\": \"status\" }": {
+		`{ "id": "ID","status": "status" }`: {
 			"ID: status\n",
 			"ID: status\n",
 			"ID: status\n",
 			"ID: status\n",
 		},
 		},
 		// With progress
 		// With progress
-		"{ \"id\": \"ID\", \"status\": \"status\", \"progress\": \"ProgressMessage\" }": {
+		`{ "id": "ID", "status": "status", "progress": "ProgressMessage" }`: {
 			"ID: status ProgressMessage",
 			"ID: status ProgressMessage",
 			fmt.Sprintf("\n%c[%dAID: status ProgressMessage%c[%dB", 27, 1, 27, 1),
 			fmt.Sprintf("\n%c[%dAID: status ProgressMessage%c[%dB", 27, 1, 27, 1),
 		},
 		},
 		// With progressDetail
 		// With progressDetail
-		"{ \"id\": \"ID\", \"status\": \"status\", \"progressDetail\": { \"Current\": 1} }": {
+		`{ "id": "ID", "status": "status", "progressDetail": { "Current": 1} }`: {
 			"", // progressbar is disabled in non-terminal
 			"", // progressbar is disabled in non-terminal
 			fmt.Sprintf("\n%c[%dA%c[2K\rID: status       1B\r%c[%dB", 27, 1, 27, 27, 1),
 			fmt.Sprintf("\n%c[%dA%c[2K\rID: status       1B\r%c[%dB", 27, 1, 27, 27, 1),
 		},
 		},