Hacker News new | ask | show | jobs
by gohrt 4044 days ago
What is the benefit of re-using the 'client' identifier? There's no closure capturing the identifier.

Compare:

        client, server := net.Pipe()
        var buf bytes.Buffer
        client = &recordingConn {
                Conn: client,
                Writer: io.MultiWriter(client, &buf),
        }
vs

        tempClient, server := net.Pipe()
        var buf bytes.Buffer
        client = &recordingConn {
                Conn: tempClient,
                Writer: io.MultiWriter(tempClient, &buf),
        }
The latter is less confusing to me.