Browse code

Merge pull request #45886 from thaJeztah/more_grepable

use string-literals for easier grep'ing

Bjorn Neergaard authored on 2023/07/05 22:02:14
Showing 32 changed files
... ...
@@ -304,7 +304,7 @@ func newGraphDriverController(ctx context.Context, rt http.RoundTripper, opt Opt
304 304
 		return nil, errors.Errorf("snapshotter doesn't support differ")
305 305
 	}
306 306
 
307
-	leases, err := lm.List(ctx, "labels.\"buildkit/lease.temporary\"")
307
+	leases, err := lm.List(ctx, `labels."buildkit/lease.temporary"`)
308 308
 	if err != nil {
309 309
 		return nil, err
310 310
 	}
... ...
@@ -53,31 +53,31 @@ func TestGetFilenameForDownload(t *testing.T) {
53 53
 		expected    string
54 54
 	}{
55 55
 		{
56
-			path:     "http://www.example.com/",
56
+			path:     "https://www.example.com/",
57 57
 			expected: "",
58 58
 		},
59 59
 		{
60
-			path:     "http://www.example.com/xyz",
60
+			path:     "https://www.example.com/xyz",
61 61
 			expected: "xyz",
62 62
 		},
63 63
 		{
64
-			path:     "http://www.example.com/xyz.html",
64
+			path:     "https://www.example.com/xyz.html",
65 65
 			expected: "xyz.html",
66 66
 		},
67 67
 		{
68
-			path:     "http://www.example.com/xyz/",
68
+			path:     "https://www.example.com/xyz/",
69 69
 			expected: "",
70 70
 		},
71 71
 		{
72
-			path:     "http://www.example.com/xyz/uvw",
72
+			path:     "https://www.example.com/xyz/uvw",
73 73
 			expected: "uvw",
74 74
 		},
75 75
 		{
76
-			path:     "http://www.example.com/xyz/uvw.html",
76
+			path:     "https://www.example.com/xyz/uvw.html",
77 77
 			expected: "uvw.html",
78 78
 		},
79 79
 		{
80
-			path:     "http://www.example.com/xyz/uvw/",
80
+			path:     "https://www.example.com/xyz/uvw/",
81 81
 			expected: "",
82 82
 		},
83 83
 		{
... ...
@@ -114,23 +114,23 @@ func TestGetFilenameForDownload(t *testing.T) {
114 114
 			expected:    "xyz.html",
115 115
 		},
116 116
 		{
117
-			disposition: "attachment; filename=\"xyz\"",
117
+			disposition: `attachment; filename="xyz"`,
118 118
 			expected:    "xyz",
119 119
 		},
120 120
 		{
121
-			disposition: "attachment; filename=\"xyz.html\"",
121
+			disposition: `attachment; filename="xyz.html"`,
122 122
 			expected:    "xyz.html",
123 123
 		},
124 124
 		{
125
-			disposition: "attachment; filename=\"/xyz.html\"",
125
+			disposition: `attachment; filename="/xyz.html"`,
126 126
 			expected:    "xyz.html",
127 127
 		},
128 128
 		{
129
-			disposition: "attachment; filename=\"/xyz/uvw\"",
129
+			disposition: `attachment; filename="/xyz/uvw"`,
130 130
 			expected:    "uvw",
131 131
 		},
132 132
 		{
133
-			disposition: "attachment; filename=\"Naïve file.txt\"",
133
+			disposition: `attachment; filename="Naïve file.txt"`,
134 134
 			expected:    "Naïve file.txt",
135 135
 		},
136 136
 	}
... ...
@@ -15,8 +15,8 @@ import (
15 15
 )
16 16
 
17 17
 var pathDenyList = map[string]bool{
18
-	"c:\\":        true,
19
-	"c:\\windows": true,
18
+	`c:\`:        true,
19
+	`c:\windows`: true,
20 20
 }
21 21
 
22 22
 func init() {
... ...
@@ -14,20 +14,20 @@ func TestEnable(t *testing.T) {
14 14
 	}()
15 15
 	Enable()
16 16
 	if os.Getenv("DEBUG") != "1" {
17
-		t.Fatalf("expected DEBUG=1, got %s\n", os.Getenv("DEBUG"))
17
+		t.Fatalf("expected DEBUG=1, got %s", os.Getenv("DEBUG"))
18 18
 	}
19 19
 	if logrus.GetLevel() != logrus.DebugLevel {
20
-		t.Fatalf("expected log level %v, got %v\n", logrus.DebugLevel, logrus.GetLevel())
20
+		t.Fatalf("expected log level %v, got %v", logrus.DebugLevel, logrus.GetLevel())
21 21
 	}
22 22
 }
23 23
 
24 24
 func TestDisable(t *testing.T) {
25 25
 	Disable()
26 26
 	if os.Getenv("DEBUG") != "" {
27
-		t.Fatalf("expected DEBUG=\"\", got %s\n", os.Getenv("DEBUG"))
27
+		t.Fatalf(`expected DEBUG="", got %s`, os.Getenv("DEBUG"))
28 28
 	}
29 29
 	if logrus.GetLevel() != logrus.InfoLevel {
30
-		t.Fatalf("expected log level %v, got %v\n", logrus.InfoLevel, logrus.GetLevel())
30
+		t.Fatalf("expected log level %v, got %v", logrus.InfoLevel, logrus.GetLevel())
31 31
 	}
32 32
 }
33 33
 
... ...
@@ -42,7 +42,7 @@ func TestImageTagInvalidSourceImageName(t *testing.T) {
42 42
 	}
43 43
 
44 44
 	err := client.ImageTag(context.Background(), "invalid_source_image_name_", "repo:tag")
45
-	if err == nil || err.Error() != "Error parsing reference: \"invalid_source_image_name_\" is not a valid repository/tag: invalid reference format" {
45
+	if err == nil || err.Error() != `Error parsing reference: "invalid_source_image_name_" is not a valid repository/tag: invalid reference format` {
46 46
 		t.Fatalf("expected Parsing Reference Error, got %v", err)
47 47
 	}
48 48
 }
... ...
@@ -359,7 +359,7 @@ func (c *Cluster) errNoManager(st nodeState) error {
359 359
 		if st.err == errSwarmCertificatesExpired {
360 360
 			return errSwarmCertificatesExpired
361 361
 		}
362
-		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."))
362
+		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.`))
363 363
 	}
364 364
 	if st.swarmNode.Manager() != nil {
365 365
 		return errors.WithStack(notAvailableError("This node is not a swarm manager. Manager is being prepared or has trouble connecting to the cluster."))
... ...
@@ -5,13 +5,13 @@ const (
5 5
 	errNoSwarm notAvailableError = "This node is not part of a swarm"
6 6
 
7 7
 	// errSwarmExists is returned on initialize or join request for a cluster that has already been activated
8
-	errSwarmExists notAvailableError = "This node is already part of a swarm. Use \"docker swarm leave\" to leave this swarm and join another one."
8
+	errSwarmExists notAvailableError = `This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.`
9 9
 
10 10
 	// errSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
11
-	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."
11
+	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.`
12 12
 
13 13
 	// errSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
14
-	errSwarmLocked notAvailableError = "Swarm is encrypted and needs to be unlocked before it can be used. Please use \"docker swarm unlock\" to unlock it."
14
+	errSwarmLocked notAvailableError = `Swarm is encrypted and needs to be unlocked before it can be used. Please use "docker swarm unlock" to unlock it.`
15 15
 
16 16
 	// errSwarmCertificatesExpired is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
17 17
 	errSwarmCertificatesExpired notAvailableError = "Swarm certificates have expired. To replace them, leave the swarm and join again."
... ...
@@ -456,7 +456,7 @@ func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector
456 456
 	} else {
457 457
 		t, err := strconv.Atoi(config.Tail)
458 458
 		if err != nil {
459
-			return nil, errors.New("tail value must be a positive integer or \"all\"")
459
+			return nil, errors.New(`tail value must be a positive integer or "all"`)
460 460
 		}
461 461
 		if t < 0 {
462 462
 			return nil, errors.New("negative tail values not supported")
... ...
@@ -700,7 +700,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, daemonCfg *configStore, hos
700 700
 	if hostConfig.CgroupParent != "" && UsingSystemd(&daemonCfg.Config) {
701 701
 		// CgroupParent for systemd cgroup should be named as "xxx.slice"
702 702
 		if len(hostConfig.CgroupParent) <= 6 || !strings.HasSuffix(hostConfig.CgroupParent, ".slice") {
703
-			return warnings, fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
703
+			return warnings, fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
704 704
 		}
705 705
 	}
706 706
 	if hostConfig.Runtime == "" {
... ...
@@ -753,7 +753,7 @@ func verifyDaemonSettings(conf *config.Config) error {
753 753
 	}
754 754
 	if conf.CgroupParent != "" && UsingSystemd(conf) {
755 755
 		if len(conf.CgroupParent) <= 6 || !strings.HasSuffix(conf.CgroupParent, ".slice") {
756
-			return fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
756
+			return fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
757 757
 		}
758 758
 	}
759 759
 
... ...
@@ -1059,7 +1059,7 @@ func initBridgeDriver(controller *libnetwork.Controller, config *config.Config)
1059 1059
 		libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
1060 1060
 		libnetwork.NetworkOptionDeferIPv6Alloc(deferIPv6Alloc))
1061 1061
 	if err != nil {
1062
-		return fmt.Errorf("Error creating default \"bridge\" network: %v", err)
1062
+		return fmt.Errorf(`error creating default "bridge" network: %v`, err)
1063 1063
 	}
1064 1064
 	return nil
1065 1065
 }
... ...
@@ -149,7 +149,7 @@ func TestParseSecurityOptWithDeprecatedColon(t *testing.T) {
149 149
 		t.Fatalf("Unexpected parseSecurityOpt error: %v", err)
150 150
 	}
151 151
 	if opts.AppArmorProfile != "test_profile" {
152
-		t.Fatalf("Unexpected AppArmorProfile, expected: \"test_profile\", got %q", opts.AppArmorProfile)
152
+		t.Fatalf(`Unexpected AppArmorProfile, expected: "test_profile", got %q`, opts.AppArmorProfile)
153 153
 	}
154 154
 
155 155
 	// test seccomp
... ...
@@ -377,7 +377,7 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create types.NetworkCrea
377 377
 	if err != nil {
378 378
 		if errors.Is(err, libnetwork.ErrDataStoreNotInitialized) {
379 379
 			//nolint: revive
380
-			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.")
380
+			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.`)
381 381
 		}
382 382
 		return nil, err
383 383
 	}
... ...
@@ -28,7 +28,7 @@ func validatePSArgs(psArgs string) error {
28 28
 			k := group[1]
29 29
 			v := group[2]
30 30
 			if k != "pid" {
31
-				return fmt.Errorf("specifying \"%s=%s\" is not allowed", k, v)
31
+				return fmt.Errorf(`specifying "%s=%s" is not allowed`, k, v)
32 32
 			}
33 33
 		}
34 34
 	}
... ...
@@ -11,8 +11,8 @@ import (
11 11
 func TestContainerTopValidatePSArgs(t *testing.T) {
12 12
 	tests := map[string]bool{
13 13
 		"ae -o uid=PID":             true,
14
-		"ae -o \"uid= PID\"":        true,  // ascii space (0x20)
15
-		"ae -o \"uid= PID\"":        false, // unicode space (U+2003, 0xe2 0x80 0x83)
14
+		`ae -o "uid= PID"`:          true,  // ascii space (0x20)
15
+		`ae -o "uid= PID"`:          false, // unicode space (U+2003, 0xe2 0x80 0x83)
16 16
 		"ae o uid=PID":              true,
17 17
 		"aeo uid=PID":               true,
18 18
 		"ae -O uid=PID":             true,
... ...
@@ -54,7 +54,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
54 54
 
55 55
 	if ctr.RemovalInProgress || ctr.Dead {
56 56
 		ctr.Unlock()
57
-		return errCannotUpdate(ctr.ID, fmt.Errorf("container is marked for removal and cannot be \"update\""))
57
+		return errCannotUpdate(ctr.ID, fmt.Errorf(`container is marked for removal and cannot be "update"`))
58 58
 	}
59 59
 
60 60
 	if err := ctr.UpdateContainer(hostConfig); err != nil {
... ...
@@ -76,7 +76,7 @@ func printCliVersion() {
76 76
 	cli.SetTestEnvironment(testEnv)
77 77
 	cmd := cli.Docker(cli.Args("version"))
78 78
 	if cmd.Error != nil {
79
-		fmt.Printf("WARNING: Failed to run \"docker version\": %+v\n", cmd.Error)
79
+		fmt.Printf("WARNING: Failed to run 'docker version': %+v\n", cmd.Error)
80 80
 		return
81 81
 	}
82 82
 
... ...
@@ -1158,7 +1158,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
1158 1158
 	assert.Assert(c, waitRun(id2) == nil)
1159 1159
 
1160 1160
 	links := inspectFieldJSON(c, id2, "HostConfig.Links")
1161
-	assert.Equal(c, links, "[\"/tlink1:/tlink2/tlink1\"]", "expected to have links between containers")
1161
+	assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
1162 1162
 
1163 1163
 	removeOptions := types.ContainerRemoveOptions{
1164 1164
 		RemoveLinks: true,
... ...
@@ -2258,7 +2258,7 @@ docker.com>"
2258 2258
   `))
2259 2259
 
2260 2260
 	res := inspectField(c, name, "Author")
2261
-	if res != "\"Docker IO <io@docker.com>\"" {
2261
+	if res != `"Docker IO <io@docker.com>"` {
2262 2262
 		c.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
2263 2263
 	}
2264 2264
 }
... ...
@@ -2272,7 +2272,7 @@ func (s *DockerCLIBuildSuite) TestBuildVerifyIntString(c *testing.T) {
2272 2272
 	MAINTAINER 123`))
2273 2273
 
2274 2274
 	out, _ := dockerCmd(c, "inspect", name)
2275
-	if !strings.Contains(out, "\"123\"") {
2275
+	if !strings.Contains(out, `"123"`) {
2276 2276
 		c.Fatalf("Output does not contain the int as a string:\n%s", out)
2277 2277
 	}
2278 2278
 }
... ...
@@ -120,17 +120,17 @@ func (s *DockerCLICommitSuite) TestCommitChange(c *testing.T) {
120 120
 	dockerCmd(c, "run", "--name", "test", "busybox", "true")
121 121
 
122 122
 	imageID, _ := dockerCmd(c, "commit",
123
-		"--change", "EXPOSE 8080",
124
-		"--change", "ENV DEBUG true",
125
-		"--change", "ENV test 1",
126
-		"--change", "ENV PATH /foo",
127
-		"--change", "LABEL foo bar",
128
-		"--change", "CMD [\"/bin/sh\"]",
129
-		"--change", "WORKDIR /opt",
130
-		"--change", "ENTRYPOINT [\"/bin/sh\"]",
131
-		"--change", "USER testuser",
132
-		"--change", "VOLUME /var/lib/docker",
133
-		"--change", "ONBUILD /usr/local/bin/python-build --dir /app/src",
123
+		"--change", `EXPOSE 8080`,
124
+		"--change", `ENV DEBUG true`,
125
+		"--change", `ENV test 1`,
126
+		"--change", `ENV PATH /foo`,
127
+		"--change", `LABEL foo bar`,
128
+		"--change", `CMD ["/bin/sh"]`,
129
+		"--change", `WORKDIR /opt`,
130
+		"--change", `ENTRYPOINT ["/bin/sh"]`,
131
+		"--change", `USER testuser`,
132
+		"--change", `VOLUME /var/lib/docker`,
133
+		"--change", `ONBUILD /usr/local/bin/python-build --dir /app/src`,
134 134
 		"test", "test-commit")
135 135
 	imageID = strings.TrimSpace(imageID)
136 136
 
... ...
@@ -750,7 +750,7 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadFunc(c *testing.T) {
750 750
 	result.Assert(c, icmd.Expected{
751 751
 		Error:    "exit status 64",
752 752
 		ExitCode: 64,
753
-		Err:      "Error parsing format: template: :1: function \"badFuncString\" not defined",
753
+		Err:      `Error parsing format: template: :1: function "badFuncString" not defined`,
754 754
 	})
755 755
 }
756 756
 
... ...
@@ -760,6 +760,6 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadField(c *testing.T) {
760 760
 	result.Assert(c, icmd.Expected{
761 761
 		Error:    "exit status 64",
762 762
 		ExitCode: 64,
763
-		Err:      "Error parsing format: template: :1:2: executing \"\" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message",
763
+		Err:      `Error parsing format: template: :1:2: executing "" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message`,
764 764
 	})
765 765
 }
... ...
@@ -414,21 +414,21 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
414 414
 	// only check for values known (daemon ID/name) or explicitly set above,
415 415
 	// otherwise just check for names being present.
416 416
 	expectedSubstrings := []string{
417
-		" daemon reload " + info.ID + " ",
418
-		"(allow-nondistributable-artifacts=[",
419
-		" debug=true, ",
420
-		" default-ipc-mode=",
421
-		" default-runtime=",
422
-		" default-shm-size=",
423
-		" insecure-registries=[",
424
-		" labels=[\"bar=foo\"], ",
425
-		" live-restore=",
426
-		" max-concurrent-downloads=1, ",
427
-		" max-concurrent-uploads=5, ",
428
-		" name=" + info.Name,
429
-		" registry-mirrors=[",
430
-		" runtimes=",
431
-		" shutdown-timeout=10)",
417
+		` daemon reload ` + info.ID + " ",
418
+		`(allow-nondistributable-artifacts=[`,
419
+		` debug=true, `,
420
+		` default-ipc-mode=`,
421
+		` default-runtime=`,
422
+		` default-shm-size=`,
423
+		` insecure-registries=[`,
424
+		` labels=["bar=foo"], `,
425
+		` live-restore=`,
426
+		` max-concurrent-downloads=1, `,
427
+		` max-concurrent-uploads=5, `,
428
+		` name=` + info.Name,
429
+		` registry-mirrors=[`,
430
+		` runtimes=`,
431
+		` shutdown-timeout=10)`,
432 432
 	}
433 433
 
434 434
 	for _, s := range expectedSubstrings {
... ...
@@ -218,7 +218,7 @@ func (s *DockerCLILinksSuite) TestLinkShortDefinition(c *testing.T) {
218 218
 	assert.Assert(c, waitRun(cid2) == nil)
219 219
 
220 220
 	links := inspectFieldJSON(c, cid2, "HostConfig.Links")
221
-	assert.Equal(c, links, "[\"/shortlinkdef:/link2/shortlinkdef\"]")
221
+	assert.Equal(c, links, `["/shortlinkdef:/link2/shortlinkdef"]`)
222 222
 }
223 223
 
224 224
 func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {
... ...
@@ -176,7 +176,7 @@ func (s *DockerCLIPsSuite) TestPsListContainersSize(c *testing.T) {
176 176
 	select {
177 177
 	case <-wait:
178 178
 	case <-time.After(3 * time.Second):
179
-		c.Fatalf("Calling \"docker ps -s\" timed out!")
179
+		c.Fatalf(`Calling "docker ps -s" timed out!`)
180 180
 	}
181 181
 	result.Assert(c, icmd.Success)
182 182
 	lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
... ...
@@ -634,8 +634,8 @@ func (s *DockerCLIPsSuite) TestPsShowMounts(c *testing.T) {
634 634
 	var bindMountSource string
635 635
 	var bindMountDestination string
636 636
 	if DaemonIsWindows() {
637
-		bindMountSource = "c:\\"
638
-		bindMountDestination = "c:\\t"
637
+		bindMountSource = `c:\`
638
+		bindMountDestination = `c:\t`
639 639
 	} else {
640 640
 		bindMountSource = "/tmp"
641 641
 		bindMountDestination = "/t"
... ...
@@ -391,7 +391,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
391 391
 
392 392
 	b, err := os.ReadFile(configPath)
393 393
 	assert.NilError(c, err)
394
-	assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
394
+	assert.Assert(c, !strings.Contains(string(b), `"auth":`))
395 395
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
396 396
 	dockerCmd(c, "--config", tmp, "push", repoName)
397 397
 
... ...
@@ -433,7 +433,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *testing.T)
433 433
 
434 434
 	b, err := os.ReadFile(configPath)
435 435
 	assert.NilError(c, err)
436
-	assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
436
+	assert.Assert(c, !strings.Contains(string(b), `"auth":`))
437 437
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
438 438
 	dockerCmd(c, "--config", tmp, "push", repoName)
439 439
 
... ...
@@ -1673,7 +1673,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeUIDGID(c *testing.T) {
1673 1673
 		RUN mkdir -p /hello && touch /hello/test && chown dockerio.dockerio /hello`))
1674 1674
 
1675 1675
 	// Test that the uid and gid is copied from the image to the volume
1676
-	out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", "ls -l / | grep hello | awk '{print $3\":\"$4}'")
1676
+	out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", `ls -l / | grep hello | awk '{print $3":"$4}'`)
1677 1677
 	out = strings.TrimSpace(out)
1678 1678
 	if out != "dockerio:dockerio" {
1679 1679
 		c.Fatalf("Wrong /hello ownership: %s, expected dockerio:dockerio", out)
... ...
@@ -2053,7 +2053,7 @@ func (s *DockerCLIRunSuite) TestRunPortInUse(c *testing.T) {
2053 2053
 		c.Fatalf("Binding on used port must fail")
2054 2054
 	}
2055 2055
 	if !strings.Contains(out, "port is already allocated") {
2056
-		c.Fatalf("Out must be about \"port is already allocated\", got %s", out)
2056
+		c.Fatalf(`Out must be about "port is already allocated", got %s`, out)
2057 2057
 	}
2058 2058
 }
2059 2059
 
... ...
@@ -229,7 +229,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *testing.T) {
229 229
 	assert.Assert(c, id != "")
230 230
 	// so, right here, we're basically inspecting by id and returning only
231 231
 	// the ID. if they don't match, the service doesn't exist.
232
-	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
232
+	result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
233 233
 	result.Assert(c, icmd.Expected{Out: id})
234 234
 
235 235
 	// make sure task has been deployed.
... ...
@@ -282,7 +282,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *testing.T) {
282 282
 	assert.Assert(c, id != "")
283 283
 	// so, right here, we're basically inspecting by id and returning only
284 284
 	// the ID. if they don't match, the service doesn't exist.
285
-	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
285
+	result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
286 286
 	result.Assert(c, icmd.Expected{Out: id})
287 287
 
288 288
 	// make sure task has been deployed.
... ...
@@ -251,9 +251,10 @@ func TestTemplatedConfig(t *testing.T) {
251 251
 		Templating: &swarmtypes.Driver{
252 252
 			Name: "golang",
253 253
 		},
254
-		Data: []byte("SERVICE_NAME={{.Service.Name}}\n" +
255
-			"{{secret \"referencedsecrettarget\"}}\n" +
256
-			"{{config \"referencedconfigtarget\"}}\n"),
254
+		Data: []byte(`SERVICE_NAME={{.Service.Name}}
255
+{{secret "referencedsecrettarget"}}
256
+{{config "referencedconfigtarget"}}
257
+`),
257 258
 	}
258 259
 
259 260
 	templatedConfig, err := c.ConfigCreate(ctx, configSpec)
... ...
@@ -26,7 +26,7 @@ func TestNoPersist(t *testing.T) {
26 26
 	defer testController.Stop()
27 27
 	nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
28 28
 	if err != nil {
29
-		t.Fatalf("Error creating default \"host\" network: %v", err)
29
+		t.Fatalf(`Error creating default "host" network: %v`, err)
30 30
 	}
31 31
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
32 32
 	if err != nil {
... ...
@@ -30,7 +30,7 @@ func testLocalBackend(t *testing.T, provider, url string, storeConfig *store.Con
30 30
 	defer testController.Stop()
31 31
 	nw, err := testController.NewNetwork("host", "host", "")
32 32
 	if err != nil {
33
-		t.Fatalf("Error creating default \"host\" network: %v", err)
33
+		t.Fatalf(`Error creating default "host" network: %v`, err)
34 34
 	}
35 35
 	ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
36 36
 	if err != nil {
... ...
@@ -71,10 +71,10 @@ func TestListOptsWithoutValidator(t *testing.T) {
71 71
 		t.Errorf("%d != 3", o.Len())
72 72
 	}
73 73
 	if !o.Get("bar") {
74
-		t.Error("o.Get(\"bar\") == false")
74
+		t.Error(`o.Get("bar") == false`)
75 75
 	}
76 76
 	if o.Get("baz") {
77
-		t.Error("o.Get(\"baz\") == true")
77
+		t.Error(`o.Get("baz") == true`)
78 78
 	}
79 79
 	o.Delete("foo")
80 80
 	if o.String() != "[bar bar]" {
... ...
@@ -106,10 +106,10 @@ func TestListOptsWithValidator(t *testing.T) {
106 106
 		t.Errorf("%d != 1", o.Len())
107 107
 	}
108 108
 	if !o.Get("max-file=2") {
109
-		t.Error("o.Get(\"max-file=2\") == false")
109
+		t.Error(`o.Get("max-file=2") == false`)
110 110
 	}
111 111
 	if o.Get("baz") {
112
-		t.Error("o.Get(\"baz\") == true")
112
+		t.Error(`o.Get("baz") == true`)
113 113
 	}
114 114
 	o.Delete("max-file=2")
115 115
 	if o.String() != "" {
... ...
@@ -361,7 +361,7 @@ func TestMapMapOpts(t *testing.T) {
361 361
 	o.Set("r1=k12=v12")
362 362
 	assert.Check(t, is.DeepEqual(tmpMap["r1"], map[string]string{"k11": "v11", "k12": "v12"}))
363 363
 
364
-	if o.Set("invalid-key={\"k\":\"v\"}") == nil {
364
+	if o.Set(`invalid-key={"k":"v"}`) == nil {
365 365
 		t.Error("validator is not being called")
366 366
 	}
367 367
 }
... ...
@@ -458,14 +458,14 @@ func TestLookupUserAndGroup(t *testing.T) {
458 458
 func TestLookupUserAndGroupThatDoesNotExist(t *testing.T) {
459 459
 	fakeUser := "fakeuser"
460 460
 	_, err := LookupUser(fakeUser)
461
-	assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeUser+"\" in passwd database"))
461
+	assert.Check(t, is.Error(err, `getent unable to find entry "fakeuser" in passwd database`))
462 462
 
463 463
 	_, err = LookupUID(-1)
464 464
 	assert.Check(t, is.ErrorContains(err, ""))
465 465
 
466 466
 	fakeGroup := "fakegroup"
467 467
 	_, err = LookupGroup(fakeGroup)
468
-	assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeGroup+"\" in group database"))
468
+	assert.Check(t, is.Error(err, `getent unable to find entry "fakegroup" in group database`))
469 469
 
470 470
 	_, err = LookupGID(-1)
471 471
 	assert.Check(t, is.ErrorContains(err, ""))
... ...
@@ -66,7 +66,7 @@ func TestFixedBufferString(t *testing.T) {
66 66
 
67 67
 	out := buf.String()
68 68
 	if out != "helloworld" {
69
-		t.Fatalf("expected output to be \"helloworld\", got %q", out)
69
+		t.Fatalf(`expected output to be "helloworld", got %q`, out)
70 70
 	}
71 71
 
72 72
 	// read 5 bytes
... ...
@@ -76,7 +76,7 @@ func TestFixedBufferString(t *testing.T) {
76 76
 	// test that fixedBuffer.String() only returns the part that hasn't been read
77 77
 	out = buf.String()
78 78
 	if out != "world" {
79
-		t.Fatalf("expected output to be \"world\", got %q", out)
79
+		t.Fatalf(`expected output to be "world", got %q`, out)
80 80
 	}
81 81
 }
82 82
 
... ...
@@ -92,7 +92,7 @@ func TestFixedBufferWrite(t *testing.T) {
92 92
 	}
93 93
 
94 94
 	if string(buf.buf[:5]) != "hello" {
95
-		t.Fatalf("expected \"hello\", got %q", string(buf.buf[:5]))
95
+		t.Fatalf(`expected "hello", got %q`, string(buf.buf[:5]))
96 96
 	}
97 97
 
98 98
 	n, err = buf.Write(bytes.Repeat([]byte{1}, 64))
... ...
@@ -121,7 +121,7 @@ func TestFixedBufferRead(t *testing.T) {
121 121
 	}
122 122
 
123 123
 	if string(b) != "hello" {
124
-		t.Fatalf("expected \"hello\", got %q", string(b))
124
+		t.Fatalf(`expected "hello", got %q`, string(b))
125 125
 	}
126 126
 
127 127
 	n, err = buf.Read(b)
... ...
@@ -134,7 +134,7 @@ func TestFixedBufferRead(t *testing.T) {
134 134
 	}
135 135
 
136 136
 	if string(b) != " worl" {
137
-		t.Fatalf("expected \" worl\", got %s", string(b))
137
+		t.Fatalf(`expected " worl", got %s`, string(b))
138 138
 	}
139 139
 
140 140
 	b = b[:1]
... ...
@@ -148,6 +148,6 @@ func TestFixedBufferRead(t *testing.T) {
148 148
 	}
149 149
 
150 150
 	if string(b) != "d" {
151
-		t.Fatalf("expected \"d\", got %s", string(b))
151
+		t.Fatalf(`expected "d", got %s`, string(b))
152 152
 	}
153 153
 }
... ...
@@ -241,22 +241,22 @@ func TestDisplayJSONMessagesStream(t *testing.T) {
241 241
 			"",
242 242
 		},
243 243
 		// Without progress & ID
244
-		"{ \"status\": \"status\" }": {
244
+		`{ "status": "status" }`: {
245 245
 			"status\n",
246 246
 			"status\n",
247 247
 		},
248 248
 		// Without progress, with ID
249
-		"{ \"id\": \"ID\",\"status\": \"status\" }": {
249
+		`{ "id": "ID","status": "status" }`: {
250 250
 			"ID: status\n",
251 251
 			"ID: status\n",
252 252
 		},
253 253
 		// With progress
254
-		"{ \"id\": \"ID\", \"status\": \"status\", \"progress\": \"ProgressMessage\" }": {
254
+		`{ "id": "ID", "status": "status", "progress": "ProgressMessage" }`: {
255 255
 			"ID: status ProgressMessage",
256 256
 			fmt.Sprintf("\n%c[%dAID: status ProgressMessage%c[%dB", 27, 1, 27, 1),
257 257
 		},
258 258
 		// With progressDetail
259
-		"{ \"id\": \"ID\", \"status\": \"status\", \"progressDetail\": { \"Current\": 1} }": {
259
+		`{ "id": "ID", "status": "status", "progressDetail": { "Current": 1} }`: {
260 260
 			"", // progressbar is disabled in non-terminal
261 261
 			fmt.Sprintf("\n%c[%dA%c[2K\rID: status       1B\r%c[%dB", 27, 1, 27, 27, 1),
262 262
 		},