Browse code

integration-cli: S1025: the argument is already a string (gosimple)

```
integration-cli/docker_cli_daemon_test.go:1753:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_daemon_test.go:1783:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_daemon_test.go:1893:92: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:444:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:600:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:602:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:610:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:613:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:614:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_external_volume_driver_test.go:617:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_plugins_test.go:431:39: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:174:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1046:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1071:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1074:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1079:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1087:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1102:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1108:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1128:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1323:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1329:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1388:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
integration-cli/docker_cli_swarm_test.go:1985:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/11 19:36:00
Showing 4 changed files
... ...
@@ -1750,7 +1750,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T
1750 1750
 			break
1751 1751
 		}
1752 1752
 		ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
1753
-		assert.Assert(c, err == nil, "%s", ip)
1753
+		assert.Assert(c, err == nil, ip)
1754 1754
 
1755 1755
 		assert.Assert(c, ip != bridgeIP)
1756 1756
 		cont++
... ...
@@ -1780,7 +1780,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
1780 1780
 
1781 1781
 	// pull a repository large enough to overfill the mounted filesystem
1782 1782
 	pullOut, err := s.d.Cmd("pull", "debian:stretch")
1783
-	assert.Assert(c, err != nil, "%s", pullOut)
1783
+	assert.Assert(c, err != nil, pullOut)
1784 1784
 	assert.Assert(c, strings.Contains(pullOut, "no space left on device"))
1785 1785
 }
1786 1786
 
... ...
@@ -1890,7 +1890,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
1890 1890
 	assert.NilError(c, err, out)
1891 1891
 	out, err = s.d.Cmd("start", "-a", "test2")
1892 1892
 	assert.NilError(c, err, out)
1893
-	assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, fmt.Sprintf("%s", out))
1893
+	assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, out)
1894 1894
 }
1895 1895
 
1896 1896
 func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {
... ...
@@ -441,7 +441,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c
441 441
 	}
442 442
 	out := inspectFieldJSON(c, "testing", "Mounts")
443 443
 	assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts) == nil)
444
-	assert.Equal(c, len(mounts), 1, fmt.Sprintf("%s", out))
444
+	assert.Equal(c, len(mounts), 1, out)
445 445
 	assert.Equal(c, mounts[0].Name, "foo")
446 446
 	assert.Equal(c, mounts[0].Driver, volumePluginName)
447 447
 }
... ...
@@ -597,9 +597,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c
597 597
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
598 598
 
599 599
 	out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
600
-	assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
600
+	assert.Equal(c, s.ec.unmounts, 0, out)
601 601
 	out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
602
-	assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
602
+	assert.Equal(c, s.ec.unmounts, 0, out)
603 603
 }
604 604
 
605 605
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) {
... ...
@@ -607,12 +607,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testi
607 607
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
608 608
 
609 609
 	out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
610
-	assert.Equal(c, s.ec.mounts, 1, fmt.Sprintf("%s", out))
610
+	assert.Equal(c, s.ec.mounts, 1, out)
611 611
 
612 612
 	out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
613
-	assert.Equal(c, s.ec.mounts, 2, fmt.Sprintf("%s", out))
614
-	assert.Equal(c, s.ec.unmounts, 1, fmt.Sprintf("%s", out))
613
+	assert.Equal(c, s.ec.mounts, 2, out)
614
+	assert.Equal(c, s.ec.unmounts, 1, out)
615 615
 
616 616
 	out, _ = s.d.Cmd("kill", "test")
617
-	assert.Equal(c, s.ec.unmounts, 2, fmt.Sprintf("%s", out))
617
+	assert.Equal(c, s.ec.unmounts, 2, out)
618 618
 }
... ...
@@ -428,7 +428,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
428 428
 
429 429
 	// make sure "v2" does not exists
430 430
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
431
-	assert.Assert(c, os.IsNotExist(err), "%s", out)
431
+	assert.Assert(c, os.IsNotExist(err), out)
432 432
 
433 433
 	dockerCmd(c, "plugin", "disable", "-f", plugin)
434 434
 	dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
... ...
@@ -171,7 +171,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
171 171
 func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
172 172
 	d := s.AddDaemon(c, true, true)
173 173
 	hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
174
-	assert.Assert(c, err == nil, "%s", hostname)
174
+	assert.Assert(c, err == nil, hostname)
175 175
 
176 176
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
177 177
 	assert.NilError(c, err, out)
... ...
@@ -1043,7 +1043,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
1043 1043
 	d := s.AddDaemon(c, false, false)
1044 1044
 
1045 1045
 	outs, err := d.Cmd("swarm", "init", "--autolock")
1046
-	assert.Assert(c, err == nil, "%s", outs)
1046
+	assert.Assert(c, err == nil, outs)
1047 1047
 	unlockKey := getUnlockKey(d, c, outs)
1048 1048
 
1049 1049
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
... ...
@@ -1068,15 +1068,15 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
1068 1068
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
1069 1069
 
1070 1070
 	outs, err = d.Cmd("node", "ls")
1071
-	assert.Assert(c, err == nil, "%s", outs)
1071
+	assert.Assert(c, err == nil, outs)
1072 1072
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
1073 1073
 	outs, err = d.Cmd("swarm", "update", "--autolock=false")
1074
-	assert.Assert(c, err == nil, "%s", outs)
1074
+	assert.Assert(c, err == nil, outs)
1075 1075
 
1076 1076
 	checkSwarmLockedToUnlocked(c, d)
1077 1077
 
1078 1078
 	outs, err = d.Cmd("node", "ls")
1079
-	assert.Assert(c, err == nil, "%s", outs)
1079
+	assert.Assert(c, err == nil, outs)
1080 1080
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
1081 1081
 }
1082 1082
 
... ...
@@ -1084,7 +1084,7 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
1084 1084
 	d := s.AddDaemon(c, false, false)
1085 1085
 
1086 1086
 	outs, err := d.Cmd("swarm", "init", "--autolock")
1087
-	assert.Assert(c, err == nil, "%s", outs)
1087
+	assert.Assert(c, err == nil, outs)
1088 1088
 
1089 1089
 	// It starts off locked
1090 1090
 	d.RestartNode(c)
... ...
@@ -1099,13 +1099,13 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
1099 1099
 	assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked."))
1100 1100
 	// It is OK for user to leave a locked swarm with --force
1101 1101
 	outs, err = d.Cmd("swarm", "leave", "--force")
1102
-	assert.Assert(c, err == nil, "%s", outs)
1102
+	assert.Assert(c, err == nil, outs)
1103 1103
 
1104 1104
 	info = d.SwarmInfo(c)
1105 1105
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
1106 1106
 
1107 1107
 	outs, err = d.Cmd("swarm", "init")
1108
-	assert.Assert(c, err == nil, "%s", outs)
1108
+	assert.Assert(c, err == nil, outs)
1109 1109
 
1110 1110
 	info = d.SwarmInfo(c)
1111 1111
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
... ...
@@ -1125,7 +1125,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) {
1125 1125
 
1126 1126
 	// enable autolock
1127 1127
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
1128
-	assert.Assert(c, err == nil, "%s", outs)
1128
+	assert.Assert(c, err == nil, outs)
1129 1129
 	unlockKey := getUnlockKey(d1, c, outs)
1130 1130
 
1131 1131
 	// The ones that got the cluster update should be set to locked
... ...
@@ -1320,13 +1320,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
1320 1320
 	d3 := s.AddDaemon(c, true, true)
1321 1321
 
1322 1322
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
1323
-	assert.Assert(c, err == nil, "%s", outs)
1323
+	assert.Assert(c, err == nil, outs)
1324 1324
 	unlockKey := getUnlockKey(d1, c, outs)
1325 1325
 
1326 1326
 	// Rotate multiple times
1327 1327
 	for i := 0; i != 3; i++ {
1328 1328
 		outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
1329
-		assert.Assert(c, err == nil, "%s", outs)
1329
+		assert.Assert(c, err == nil, outs)
1330 1330
 		// Strip \n
1331 1331
 		newUnlockKey := outs[:len(outs)-1]
1332 1332
 		assert.Assert(c, newUnlockKey != "")
... ...
@@ -1385,7 +1385,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
1385 1385
 						continue
1386 1386
 					}
1387 1387
 				}
1388
-				assert.Assert(c, err == nil, "%s", outs)
1388
+				assert.Assert(c, err == nil, outs)
1389 1389
 				assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
1390 1390
 				break
1391 1391
 			}
... ...
@@ -1982,7 +1982,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
1982 1982
 
1983 1983
 func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string {
1984 1984
 	unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
1985
-	assert.Assert(c, err == nil, "%s", unlockKey)
1985
+	assert.Assert(c, err == nil, unlockKey)
1986 1986
 	unlockKey = strings.TrimSuffix(unlockKey, "\n")
1987 1987
 
1988 1988
 	// Check that "docker swarm init --autolock" or "docker swarm update --autolock"