Pārlūkot izejas kodu

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 5 gadi atpakaļ
vecāks
revīzija
a2f16b0ad3

+ 3 - 3
integration-cli/docker_cli_daemon_test.go

@@ -1750,7 +1750,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T
 			break
 			break
 		}
 		}
 		ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
 		ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
-		assert.Assert(c, err == nil, "%s", ip)
+		assert.Assert(c, err == nil, ip)
 
 
 		assert.Assert(c, ip != bridgeIP)
 		assert.Assert(c, ip != bridgeIP)
 		cont++
 		cont++
@@ -1780,7 +1780,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
 
 
 	// pull a repository large enough to overfill the mounted filesystem
 	// pull a repository large enough to overfill the mounted filesystem
 	pullOut, err := s.d.Cmd("pull", "debian:stretch")
 	pullOut, err := s.d.Cmd("pull", "debian:stretch")
-	assert.Assert(c, err != nil, "%s", pullOut)
+	assert.Assert(c, err != nil, pullOut)
 	assert.Assert(c, strings.Contains(pullOut, "no space left on device"))
 	assert.Assert(c, strings.Contains(pullOut, "no space left on device"))
 }
 }
 
 
@@ -1890,7 +1890,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
 	assert.NilError(c, err, out)
 	assert.NilError(c, err, out)
 	out, err = s.d.Cmd("start", "-a", "test2")
 	out, err = s.d.Cmd("start", "-a", "test2")
 	assert.NilError(c, err, out)
 	assert.NilError(c, err, out)
-	assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, fmt.Sprintf("%s", out))
+	assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, out)
 }
 }
 
 
 func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {
 func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {

+ 7 - 7
integration-cli/docker_cli_external_volume_driver_test.go

@@ -441,7 +441,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c
 	}
 	}
 	out := inspectFieldJSON(c, "testing", "Mounts")
 	out := inspectFieldJSON(c, "testing", "Mounts")
 	assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts) == nil)
 	assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts) == nil)
-	assert.Equal(c, len(mounts), 1, fmt.Sprintf("%s", out))
+	assert.Equal(c, len(mounts), 1, out)
 	assert.Equal(c, mounts[0].Name, "foo")
 	assert.Equal(c, mounts[0].Name, "foo")
 	assert.Equal(c, mounts[0].Driver, volumePluginName)
 	assert.Equal(c, mounts[0].Driver, volumePluginName)
 }
 }
@@ -597,9 +597,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
 
 
 	out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
 	out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
-	assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
+	assert.Equal(c, s.ec.unmounts, 0, out)
 	out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
 	out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
-	assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
+	assert.Equal(c, s.ec.unmounts, 0, out)
 }
 }
 
 
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) {
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) {
@@ -607,12 +607,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testi
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
 	s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
 
 
 	out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
 	out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
-	assert.Equal(c, s.ec.mounts, 1, fmt.Sprintf("%s", out))
+	assert.Equal(c, s.ec.mounts, 1, out)
 
 
 	out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
 	out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
-	assert.Equal(c, s.ec.mounts, 2, fmt.Sprintf("%s", out))
-	assert.Equal(c, s.ec.unmounts, 1, fmt.Sprintf("%s", out))
+	assert.Equal(c, s.ec.mounts, 2, out)
+	assert.Equal(c, s.ec.unmounts, 1, out)
 
 
 	out, _ = s.d.Cmd("kill", "test")
 	out, _ = s.d.Cmd("kill", "test")
-	assert.Equal(c, s.ec.unmounts, 2, fmt.Sprintf("%s", out))
+	assert.Equal(c, s.ec.unmounts, 2, out)
 }
 }

+ 1 - 1
integration-cli/docker_cli_plugins_test.go

@@ -428,7 +428,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
 
 
 	// make sure "v2" does not exists
 	// make sure "v2" does not exists
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
-	assert.Assert(c, os.IsNotExist(err), "%s", out)
+	assert.Assert(c, os.IsNotExist(err), out)
 
 
 	dockerCmd(c, "plugin", "disable", "-f", plugin)
 	dockerCmd(c, "plugin", "disable", "-f", plugin)
 	dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
 	dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)

+ 13 - 13
integration-cli/docker_cli_swarm_test.go

@@ -171,7 +171,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
 func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
 func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
 	d := s.AddDaemon(c, true, true)
 	d := s.AddDaemon(c, true, true)
 	hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
 	hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
-	assert.Assert(c, err == nil, "%s", hostname)
+	assert.Assert(c, err == nil, hostname)
 
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
 	assert.NilError(c, err, out)
 	assert.NilError(c, err, out)
@@ -1043,7 +1043,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
 	d := s.AddDaemon(c, false, false)
 	d := s.AddDaemon(c, false, false)
 
 
 	outs, err := d.Cmd("swarm", "init", "--autolock")
 	outs, err := d.Cmd("swarm", "init", "--autolock")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 	unlockKey := getUnlockKey(d, c, outs)
 	unlockKey := getUnlockKey(d, c, outs)
 
 
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
@@ -1068,15 +1068,15 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
 	assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
 
 
 	outs, err = d.Cmd("node", "ls")
 	outs, err = d.Cmd("node", "ls")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 	outs, err = d.Cmd("swarm", "update", "--autolock=false")
 	outs, err = d.Cmd("swarm", "update", "--autolock=false")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 
 
 	checkSwarmLockedToUnlocked(c, d)
 	checkSwarmLockedToUnlocked(c, d)
 
 
 	outs, err = d.Cmd("node", "ls")
 	outs, err = d.Cmd("node", "ls")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 	assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 }
 }
 
 
@@ -1084,7 +1084,7 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
 	d := s.AddDaemon(c, false, false)
 	d := s.AddDaemon(c, false, false)
 
 
 	outs, err := d.Cmd("swarm", "init", "--autolock")
 	outs, err := d.Cmd("swarm", "init", "--autolock")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 
 
 	// It starts off locked
 	// It starts off locked
 	d.RestartNode(c)
 	d.RestartNode(c)
@@ -1099,13 +1099,13 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
 	assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked."))
 	assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked."))
 	// It is OK for user to leave a locked swarm with --force
 	// It is OK for user to leave a locked swarm with --force
 	outs, err = d.Cmd("swarm", "leave", "--force")
 	outs, err = d.Cmd("swarm", "leave", "--force")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 
 
 	info = d.SwarmInfo(c)
 	info = d.SwarmInfo(c)
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 
 	outs, err = d.Cmd("swarm", "init")
 	outs, err = d.Cmd("swarm", "init")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 
 
 	info = d.SwarmInfo(c)
 	info = d.SwarmInfo(c)
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
@@ -1125,7 +1125,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) {
 
 
 	// enable autolock
 	// enable autolock
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 	unlockKey := getUnlockKey(d1, c, outs)
 	unlockKey := getUnlockKey(d1, c, outs)
 
 
 	// The ones that got the cluster update should be set to locked
 	// The ones that got the cluster update should be set to locked
@@ -1320,13 +1320,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
 	d3 := s.AddDaemon(c, true, true)
 	d3 := s.AddDaemon(c, true, true)
 
 
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
 	outs, err := d1.Cmd("swarm", "update", "--autolock")
-	assert.Assert(c, err == nil, "%s", outs)
+	assert.Assert(c, err == nil, outs)
 	unlockKey := getUnlockKey(d1, c, outs)
 	unlockKey := getUnlockKey(d1, c, outs)
 
 
 	// Rotate multiple times
 	// Rotate multiple times
 	for i := 0; i != 3; i++ {
 	for i := 0; i != 3; i++ {
 		outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
 		outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
-		assert.Assert(c, err == nil, "%s", outs)
+		assert.Assert(c, err == nil, outs)
 		// Strip \n
 		// Strip \n
 		newUnlockKey := outs[:len(outs)-1]
 		newUnlockKey := outs[:len(outs)-1]
 		assert.Assert(c, newUnlockKey != "")
 		assert.Assert(c, newUnlockKey != "")
@@ -1385,7 +1385,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
 						continue
 						continue
 					}
 					}
 				}
 				}
-				assert.Assert(c, err == nil, "%s", outs)
+				assert.Assert(c, err == nil, outs)
 				assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 				assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
 				break
 				break
 			}
 			}
@@ -1982,7 +1982,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
 
 
 func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string {
 func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string {
 	unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
 	unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
-	assert.Assert(c, err == nil, "%s", unlockKey)
+	assert.Assert(c, err == nil, unlockKey)
 	unlockKey = strings.TrimSuffix(unlockKey, "\n")
 	unlockKey = strings.TrimSuffix(unlockKey, "\n")
 
 
 	// Check that "docker swarm init --autolock" or "docker swarm update --autolock"
 	// Check that "docker swarm init --autolock" or "docker swarm update --autolock"