net/context: Don't leak goroutines in Done example.

The current example leaks the DoSomethingSlow goroutine for an
arbitrarily long time.  In a real server, that can lead to an
out-of-memory failure during events such as network outages; a
more careful version of that example would be too long for a
simple package doc.

Fortunately, there are other short, common patterns using Done
that don't leak and don't require a lot of explanation.  Let's
use one of those instead.

Change-Id: I0ad0c6121d06b757a397e0e71be9e01ccfd75f77
Reviewed-by: Andrew Gerrand <>
1 file changed