1
0
mirror of https://github.com/moby/moby.git synced 2025-11-05 03:50:48 +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

@@ -104,11 +104,11 @@ func (s *DockerCLIAttachSuite) TestAttachAfterDetach(c *testing.T) {
go func() {
time.Sleep(500 * time.Millisecond)
cpty.Write([]byte("\n"))
_, _ = cpty.WriteString("\n")
time.Sleep(500 * time.Millisecond)
nBytes, err = cpty.Read(bytes)
cpty.Close()
_ = cpty.Close()
readErr <- err
}()
@@ -141,7 +141,7 @@ func (s *DockerCLIAttachSuite) TestAttachDetach(c *testing.T) {
assert.NilError(c, err)
cli.WaitRun(c, id)
_, err = cpty.Write([]byte("hello\n"))
_, err = cpty.WriteString("hello\n")
assert.NilError(c, err)
out, err = bufio.NewReader(stdout).ReadString('\n')
assert.NilError(c, err)