net/http: use of Write method on Request/Response/Header is confusing #19104
Labels
Comments
@bradfitz reason behind closing? |
Because it's Go2. We know where to find Go2 stuff later. We won't be searching for "is:open label:Go2" later. I also don't want to encourage people to file Go2 bugs about everything they don't like. Hidden away is fine. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think the choice of
Write
as the method name for writing to anio.Writer
in wire format is poor.Write
is a well known method name coming from theio.Writer
interface, so it can be confused with it.But worse than that, while
Write([]byte) error
modifies the receiver,Write(io.Writer) error
modifies the argument.I understand that the signatures are different, but if I'm quickly reading code I want to be able to understand what's going on without keeping track of types and signtures. Right now, if I see this line, it's very hard to know which of the two it is without reading more code and some light investigation:
I think a better name would be
WriteTo
orWriteToWire
. Suggestions welcome.This can't be done in Go 1.x, so marking as Go2.
The text was updated successfully, but these errors were encountered: