title: Idiomatic way to timeout TCP handshake in Go
body: <p>What is the idiomatic way in Go to timeout a TCP conversation, such as initial protocol handshake? Let's say there is a goroutine that handles the TCP conversation. I can launch it, then launch a <code>time.After()</code>, then <code>select</code> for both of them and if timeout was hit, proceed on doing other stuff.</p>
  
  <p>However, that means that the TCP goroutine will linger on after the timeout keeping the TCP connection alive even though nobody will ever need it.</p>