mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
gosimple: S1039: unnecessary use of fmt.Sprintf
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>
(cherry picked from commit f77213efc2
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
fadf8bbdff
commit
2ddf6e598a
5 changed files with 20 additions and 20 deletions
|
@ -67,7 +67,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
|||
id := strings.TrimSpace(out)
|
||||
|
||||
getGoRoutines := func() int {
|
||||
_, body, err := request.Get(fmt.Sprintf("/info"))
|
||||
_, body, err := request.Get("/info")
|
||||
assert.NilError(c, err)
|
||||
info := types.Info{}
|
||||
err = json.NewDecoder(body).Decode(&info)
|
||||
|
@ -78,7 +78,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
|||
|
||||
// When the HTTP connection is closed, the number of goroutines should not increase.
|
||||
routines := getGoRoutines()
|
||||
_, body, err := request.Get(fmt.Sprintf("/containers/%s/stats", id))
|
||||
_, body, err := request.Get("/containers/" + id + "/stats")
|
||||
assert.NilError(c, err)
|
||||
body.Close()
|
||||
|
||||
|
@ -190,7 +190,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) {
|
|||
func getNetworkStats(c *testing.T, id string) map[string]types.NetworkStats {
|
||||
var st *types.StatsJSON
|
||||
|
||||
_, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
|
||||
_, body, err := request.Get("/containers/" + id + "/stats?stream=false")
|
||||
assert.NilError(c, err)
|
||||
|
||||
err = json.NewDecoder(body).Decode(&st)
|
||||
|
@ -207,7 +207,7 @@ func getNetworkStats(c *testing.T, id string) map[string]types.NetworkStats {
|
|||
func getVersionedStats(c *testing.T, id string, apiVersion string) map[string]interface{} {
|
||||
stats := make(map[string]interface{})
|
||||
|
||||
_, body, err := request.Get(fmt.Sprintf("/%s/containers/%s/stats?stream=false", apiVersion, id))
|
||||
_, body, err := request.Get("/" + apiVersion + "/containers/" + id + "/stats?stream=false")
|
||||
assert.NilError(c, err)
|
||||
defer body.Close()
|
||||
|
||||
|
@ -284,7 +284,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
|
|||
|
||||
ch := make(chan error, 1)
|
||||
go func() {
|
||||
resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id2))
|
||||
resp, body, err := request.Get("/containers/" + id2 + "/stats?stream=false")
|
||||
defer body.Close()
|
||||
if err != nil {
|
||||
ch <- err
|
||||
|
|
|
@ -4544,16 +4544,16 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *testing.T) {
|
|||
`
|
||||
result := buildImage("testbuildtimeargenv",
|
||||
cli.WithFlags(
|
||||
"--build-arg", fmt.Sprintf("FOO1=fromcmd"),
|
||||
"--build-arg", fmt.Sprintf("FOO2="),
|
||||
"--build-arg", fmt.Sprintf("FOO3"), // set in env
|
||||
"--build-arg", fmt.Sprintf("FOO4"), // not set in env
|
||||
"--build-arg", fmt.Sprintf("FOO5=fromcmd"),
|
||||
"--build-arg", "FOO1=fromcmd",
|
||||
"--build-arg", "FOO2=",
|
||||
"--build-arg", "FOO3", // set in env
|
||||
"--build-arg", "FOO4", // not set in env
|
||||
"--build-arg", "FOO5=fromcmd",
|
||||
// FOO6 is not set at all
|
||||
"--build-arg", fmt.Sprintf("FOO7=fromcmd"), // should produce a warning
|
||||
"--build-arg", fmt.Sprintf("FOO8="), // should produce a warning
|
||||
"--build-arg", fmt.Sprintf("FOO9"), // should produce a warning
|
||||
"--build-arg", fmt.Sprintf("FO10"), // not set in env, empty value
|
||||
"--build-arg", "FOO7=fromcmd", // should produce a warning
|
||||
"--build-arg", "FOO8=", // should produce a warning
|
||||
"--build-arg", "FOO9", // should produce a warning
|
||||
"--build-arg", "FO10", // not set in env, empty value
|
||||
),
|
||||
cli.WithEnvironmentVariables(append(os.Environ(),
|
||||
"FOO1=fromenv",
|
||||
|
@ -4665,7 +4665,7 @@ func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *testing.T) {
|
|||
|
||||
result := cli.BuildCmd(c, imgName,
|
||||
build.WithDockerfile(dockerfile),
|
||||
cli.WithFlags("--build-arg", fmt.Sprintf("tag=latest")))
|
||||
cli.WithFlags("--build-arg", "tag=latest"))
|
||||
result.Assert(c, icmd.Success)
|
||||
|
||||
result = cli.DockerCmd(c, "images", "-q", "-f", "label=multifromtest=1")
|
||||
|
@ -4687,7 +4687,7 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *testing.T) {
|
|||
|
||||
result := cli.BuildCmd(c, imgName,
|
||||
build.WithDockerfile(dockerfile),
|
||||
cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc")))
|
||||
cli.WithFlags("--build-arg", "baz=abc"))
|
||||
result.Assert(c, icmd.Success)
|
||||
assert.Assert(c, strings.Contains(result.Combined(), "[Warning]"))
|
||||
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
|
|||
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
|
||||
switch t := data.(type) {
|
||||
case error:
|
||||
fmt.Fprintln(w, fmt.Sprintf(`{"Err": %q}`, t.Error()))
|
||||
fmt.Fprintf(w, "{\"Err\": %q}\n", t.Error())
|
||||
case string:
|
||||
fmt.Fprintln(w, t)
|
||||
default:
|
||||
|
@ -318,7 +318,7 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu
|
|||
parent := r.URL.Query().Get("parent")
|
||||
|
||||
if id == "" {
|
||||
http.Error(w, fmt.Sprintf("missing id"), 409)
|
||||
http.Error(w, "missing id", 409)
|
||||
}
|
||||
|
||||
size, err := driver.ApplyDiff(id, parent, diff)
|
||||
|
|
|
@ -381,7 +381,7 @@ func CancelDeferredRemove(deviceName string) error {
|
|||
return fmt.Errorf("devicemapper: Can't set sector %s", err)
|
||||
}
|
||||
|
||||
if err := task.setMessage(fmt.Sprintf("@cancel_deferred_remove")); err != nil {
|
||||
if err := task.setMessage("@cancel_deferred_remove"); err != nil {
|
||||
return fmt.Errorf("devicemapper: Can't set message %s", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ func TestDisplayJSONMessagesStream(t *testing.T) {
|
|||
// Without progress, with ID
|
||||
"{ \"id\": \"ID\",\"status\": \"status\" }": {
|
||||
"ID: status\n",
|
||||
fmt.Sprintf("ID: status\n"),
|
||||
"ID: status\n",
|
||||
},
|
||||
// With progress
|
||||
"{ \"id\": \"ID\", \"status\": \"status\", \"progress\": \"ProgressMessage\" }": {
|
||||
|
|
Loading…
Reference in a new issue