Example code (note that it won’t actually execute in the playground since it’s 
making network calls):
https://play.golang.com/p/V9Z-ErjgICW

My assumption was that this code is a potential data race and requires 
additional synchronization on t. net/http/httptrace in particular says: 
"Functions may be called concurrently from different goroutines and some may be 
called after the request has completed or failed.”

However, I see code sans synchronization frequently in the wild, httpstat being 
one example (https://github.com/davecheney/httpstat/blob/master/main.go#L221).

Is there some additional synchronization guarantee provided by eg. client.Do() 
that I’m missing and that makes this safe, or is the fact that it doesn’t trip 
a race happenstance? 

-eli

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/E8ABE9D1-BE70-4543-A776-3D640AA857E9%40siliconsprawl.com.

Reply via email to