I was fiddling around and tried implementing my own MultiWriter and after a while I was satisfied that it was an exact replica of io.MultiWriter until I actually looked:
Why is the check even there?
As I understand, the contract of the interface Writer specifically says:
Write must return a non-nil error if it returns n < len(p)
Since the check to err != nil precedes n != len(p), any proper Writer should never encounter a situation where the length check is false.
Is this an intentional "fix" to rogue Writers out there?
Or is this redundant and should just be changed?
And since if n > len(p) the error shouldn't be ErrShortWrite anyways so I'd think it rules out the possibility of fixing some Writer writing more bytes than len(p).