pkg/devicemapper/devmapper.go:383:28: S1039: unnecessary use of fmt.Sprintf (gosimple)
if err := task.setMessage(fmt.Sprintf("@cancel_deferred_remove")); err != nil {
^
integration/plugin/graphdriver/external_test.go:321:18: S1039: unnecessary use of fmt.Sprintf (gosimple)
http.Error(w, fmt.Sprintf("missing id"), 409)
^
integration-cli/docker_api_stats_test.go:70:31: S1039: unnecessary use of fmt.Sprintf (gosimple)
_, body, err := request.Get(fmt.Sprintf("/info"))
^
integration-cli/docker_cli_build_test.go:4547:19: S1039: unnecessary use of fmt.Sprintf (gosimple)
"--build-arg", fmt.Sprintf("FOO1=fromcmd"),
^
integration-cli/docker_cli_build_test.go:4548:19: S1039: unnecessary use of fmt.Sprintf (gosimple)
"--build-arg", fmt.Sprintf("FOO2="),
^
integration-cli/docker_cli_build_test.go:4549:19: S1039: unnecessary use of fmt.Sprintf (gosimple)
"--build-arg", fmt.Sprintf("FOO3"), // set in env
^
integration-cli/docker_cli_build_test.go:4668:32: S1039: unnecessary use of fmt.Sprintf (gosimple)
cli.WithFlags("--build-arg", fmt.Sprintf("tag=latest")))
^
integration-cli/docker_cli_build_test.go:4690:32: S1039: unnecessary use of fmt.Sprintf (gosimple)
cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc")))
^
pkg/jsonmessage/jsonmessage_test.go:255:4: S1039: unnecessary use of fmt.Sprintf (gosimple)
fmt.Sprintf("ID: status\n"),
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -67,7 +67,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
| 67 | 67 |
id := strings.TrimSpace(out) |
| 68 | 68 |
|
| 69 | 69 |
getGoRoutines := func() int {
|
| 70 |
- _, body, err := request.Get(fmt.Sprintf("/info"))
|
|
| 70 |
+ _, body, err := request.Get("/info")
|
|
| 71 | 71 |
assert.NilError(c, err) |
| 72 | 72 |
info := types.Info{}
|
| 73 | 73 |
err = json.NewDecoder(body).Decode(&info) |
| ... | ... |
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
| 78 | 78 |
|
| 79 | 79 |
// When the HTTP connection is closed, the number of goroutines should not increase. |
| 80 | 80 |
routines := getGoRoutines() |
| 81 |
- _, body, err := request.Get(fmt.Sprintf("/containers/%s/stats", id))
|
|
| 81 |
+ _, body, err := request.Get("/containers/" + id + "/stats")
|
|
| 82 | 82 |
assert.NilError(c, err) |
| 83 | 83 |
body.Close() |
| 84 | 84 |
|
| ... | ... |
@@ -190,7 +190,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) {
|
| 190 | 190 |
func getNetworkStats(c *testing.T, id string) map[string]types.NetworkStats {
|
| 191 | 191 |
var st *types.StatsJSON |
| 192 | 192 |
|
| 193 |
- _, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
|
|
| 193 |
+ _, body, err := request.Get("/containers/" + id + "/stats?stream=false")
|
|
| 194 | 194 |
assert.NilError(c, err) |
| 195 | 195 |
|
| 196 | 196 |
err = json.NewDecoder(body).Decode(&st) |
| ... | ... |
@@ -207,7 +207,7 @@ func getNetworkStats(c *testing.T, id string) map[string]types.NetworkStats {
|
| 207 | 207 |
func getVersionedStats(c *testing.T, id string, apiVersion string) map[string]interface{} {
|
| 208 | 208 |
stats := make(map[string]interface{})
|
| 209 | 209 |
|
| 210 |
- _, body, err := request.Get(fmt.Sprintf("/%s/containers/%s/stats?stream=false", apiVersion, id))
|
|
| 210 |
+ _, body, err := request.Get("/" + apiVersion + "/containers/" + id + "/stats?stream=false")
|
|
| 211 | 211 |
assert.NilError(c, err) |
| 212 | 212 |
defer body.Close() |
| 213 | 213 |
|
| ... | ... |
@@ -284,7 +284,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
|
| 284 | 284 |
|
| 285 | 285 |
ch := make(chan error, 1) |
| 286 | 286 |
go func() {
|
| 287 |
- resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id2))
|
|
| 287 |
+ resp, body, err := request.Get("/containers/" + id2 + "/stats?stream=false")
|
|
| 288 | 288 |
defer body.Close() |
| 289 | 289 |
if err != nil {
|
| 290 | 290 |
ch <- err |
| ... | ... |
@@ -4544,16 +4544,16 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *testing.T) {
|
| 4544 | 4544 |
` |
| 4545 | 4545 |
result := buildImage("testbuildtimeargenv",
|
| 4546 | 4546 |
cli.WithFlags( |
| 4547 |
- "--build-arg", fmt.Sprintf("FOO1=fromcmd"),
|
|
| 4548 |
- "--build-arg", fmt.Sprintf("FOO2="),
|
|
| 4549 |
- "--build-arg", fmt.Sprintf("FOO3"), // set in env
|
|
| 4550 |
- "--build-arg", fmt.Sprintf("FOO4"), // not set in env
|
|
| 4551 |
- "--build-arg", fmt.Sprintf("FOO5=fromcmd"),
|
|
| 4547 |
+ "--build-arg", "FOO1=fromcmd", |
|
| 4548 |
+ "--build-arg", "FOO2=", |
|
| 4549 |
+ "--build-arg", "FOO3", // set in env |
|
| 4550 |
+ "--build-arg", "FOO4", // not set in env |
|
| 4551 |
+ "--build-arg", "FOO5=fromcmd", |
|
| 4552 | 4552 |
// FOO6 is not set at all |
| 4553 |
- "--build-arg", fmt.Sprintf("FOO7=fromcmd"), // should produce a warning
|
|
| 4554 |
- "--build-arg", fmt.Sprintf("FOO8="), // should produce a warning
|
|
| 4555 |
- "--build-arg", fmt.Sprintf("FOO9"), // should produce a warning
|
|
| 4556 |
- "--build-arg", fmt.Sprintf("FO10"), // not set in env, empty value
|
|
| 4553 |
+ "--build-arg", "FOO7=fromcmd", // should produce a warning |
|
| 4554 |
+ "--build-arg", "FOO8=", // should produce a warning |
|
| 4555 |
+ "--build-arg", "FOO9", // should produce a warning |
|
| 4556 |
+ "--build-arg", "FO10", // not set in env, empty value |
|
| 4557 | 4557 |
), |
| 4558 | 4558 |
cli.WithEnvironmentVariables(append(os.Environ(), |
| 4559 | 4559 |
"FOO1=fromenv", |
| ... | ... |
@@ -4665,7 +4665,7 @@ func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *testing.T) {
|
| 4665 | 4665 |
|
| 4666 | 4666 |
result := cli.BuildCmd(c, imgName, |
| 4667 | 4667 |
build.WithDockerfile(dockerfile), |
| 4668 |
- cli.WithFlags("--build-arg", fmt.Sprintf("tag=latest")))
|
|
| 4668 |
+ cli.WithFlags("--build-arg", "tag=latest"))
|
|
| 4669 | 4669 |
result.Assert(c, icmd.Success) |
| 4670 | 4670 |
|
| 4671 | 4671 |
result = cli.DockerCmd(c, "images", "-q", "-f", "label=multifromtest=1") |
| ... | ... |
@@ -4687,7 +4687,7 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *testing.T) {
|
| 4687 | 4687 |
|
| 4688 | 4688 |
result := cli.BuildCmd(c, imgName, |
| 4689 | 4689 |
build.WithDockerfile(dockerfile), |
| 4690 |
- cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc")))
|
|
| 4690 |
+ cli.WithFlags("--build-arg", "baz=abc"))
|
|
| 4691 | 4691 |
result.Assert(c, icmd.Success) |
| 4692 | 4692 |
assert.Assert(c, strings.Contains(result.Combined(), "[Warning]")) |
| 4693 | 4693 |
assert.Assert(c, strings.Contains(result.Combined(), "[baz] were not consumed")) |
| ... | ... |
@@ -129,7 +129,7 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu |
| 129 | 129 |
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
|
| 130 | 130 |
switch t := data.(type) {
|
| 131 | 131 |
case error: |
| 132 |
- fmt.Fprintln(w, fmt.Sprintf(`{"Err": %q}`, t.Error()))
|
|
| 132 |
+ fmt.Fprintf(w, "{\"Err\": %q}\n", t.Error())
|
|
| 133 | 133 |
case string: |
| 134 | 134 |
fmt.Fprintln(w, t) |
| 135 | 135 |
default: |
| ... | ... |
@@ -318,7 +318,7 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu |
| 318 | 318 |
parent := r.URL.Query().Get("parent")
|
| 319 | 319 |
|
| 320 | 320 |
if id == "" {
|
| 321 |
- http.Error(w, fmt.Sprintf("missing id"), 409)
|
|
| 321 |
+ http.Error(w, "missing id", 409) |
|
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
size, err := driver.ApplyDiff(id, parent, diff) |
| ... | ... |
@@ -380,7 +380,7 @@ func CancelDeferredRemove(deviceName string) error {
|
| 380 | 380 |
return fmt.Errorf("devicemapper: Can't set sector %s", err)
|
| 381 | 381 |
} |
| 382 | 382 |
|
| 383 |
- if err := task.setMessage(fmt.Sprintf("@cancel_deferred_remove")); err != nil {
|
|
| 383 |
+ if err := task.setMessage("@cancel_deferred_remove"); err != nil {
|
|
| 384 | 384 |
return fmt.Errorf("devicemapper: Can't set message %s", err)
|
| 385 | 385 |
} |
| 386 | 386 |
|
| ... | ... |
@@ -252,7 +252,7 @@ func TestDisplayJSONMessagesStream(t *testing.T) {
|
| 252 | 252 |
// Without progress, with ID |
| 253 | 253 |
"{ \"id\": \"ID\",\"status\": \"status\" }": {
|
| 254 | 254 |
"ID: status\n", |
| 255 |
- fmt.Sprintf("ID: status\n"),
|
|
| 255 |
+ "ID: status\n", |
|
| 256 | 256 |
}, |
| 257 | 257 |
// With progress |
| 258 | 258 |
"{ \"id\": \"ID\", \"status\": \"status\", \"progress\": \"ProgressMessage\" }": {
|