Use io.WriteString

... mostly so that I get practice and remember this exists in the future.

(This saves one allocation & copy when the target implements
io.StringWriter. And that makes absolutely no relevant difference
on this path.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2023-02-27 18:01:15 +01:00
parent ad1b09dea4
commit 2a6a944c13

View File

@ -99,7 +99,7 @@ func runExecCmdWithInput(t *testing.T, cmd *exec.Cmd, input string) {
require.NoError(t, err)
err = cmd.Start()
require.NoError(t, err)
_, err = stdin.Write([]byte(input))
_, err = io.WriteString(stdin, input)
require.NoError(t, err)
err = stdin.Close()
require.NoError(t, err)