Skip to content

byte-string-write

Default severity: warning

io.WriteString(writer, string(bytes)) allocates and copies the byte slice before writing it. The writer already accepts bytes through Write, so write the original slice directly.

_, err := io.WriteString(writer, string(bytes))
_, err := writer.Write(bytes)