1
0
mirror of https://github.com/moby/moby.git synced 2025-12-17 00:02:44 +03:00

integration-cli: avoid allocations with (*os.File).WriteString (mirror)

integration-cli/docker_cli_attach_unix_test.go:107:3: avoid allocations with (*os.File).WriteString (mirror)
            cpty.Write([]byte("\n"))
            ^
    integration-cli/docker_cli_attach_unix_test.go:144:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("hello\n"))
                 ^
    integration-cli/docker_cli_exec_test.go:422:16: avoid allocations with (*os.File).WriteString (mirror)
            if _, err := f.Write([]byte("success2\n")); err != nil {
                         ^
    integration-cli/docker_cli_exec_unix_test.go:57:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = p.Write([]byte("cat /foo && exit\n"))
                 ^
    integration-cli/docker_cli_run_test.go:4092:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(data)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:110:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("hello\n"))
                 ^
    integration-cli/docker_cli_run_unix_test.go:169:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:283:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:364:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:438:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:880:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:915:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:952:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:1418:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1445:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1483:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1517:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_update_unix_test.go:235:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("exit\n"))
                 ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-02-07 22:04:45 +01:00
parent 405ce2ef15
commit 6ff3dfd88a
6 changed files with 33 additions and 31 deletions

View File

@@ -54,7 +54,7 @@ func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
assert.NilError(c, err)
defer p.Close()
_, err = p.Write([]byte("cat /foo && exit\n"))
_, err = p.WriteString("cat /foo && exit\n")
assert.NilError(c, err)
chErr := make(chan error, 1)