This removes a for loop around io.Writer.Write() calls in
session.send(). The loop looks like what you would write in C when
making write(2) syscalls. With C and write(2), you need to account for
partial writes and call write(2) more than once. This is not how Go's
io.Writer works. The io.Writer contract clearly states that "Write
must return a non-nil error if it returns n < len(p)". Dealing with
partial writes is the responsibility of implementations of
io.Writer, not that of callers.
Removing the for loop makes the code simpler and more idiomatic.
This removes a for loop around io.Writer.Write() calls in session.send(). The loop looks like what you would write in C when making write(2) syscalls. With C and write(2), you need to account for partial writes and call write(2) more than once. This is not how Go's io.Writer works. The io.Writer contract clearly states that "Write must return a non-nil error if it returns n < len(p)". Dealing with partial writes is the responsibility of implementations of io.Writer, not that of callers.
Removing the for loop makes the code simpler and more idiomatic.