Hi,

I'm still pretty new to go. Hope this question isn't too stupid.

I'm writing a restful API server, and in order to send a response, I need 
to query a db to get its content type and then send the actually file that 
lives on the file system. Now the question is, should I put db.QueryRow and 
os.Open each in a goroutine to make them concurrent?

And a more general question is, when using APIs from the stdlib or 
3rd-party packages, how do I determine whether to wrap them in goroutines 
when more than one of them need to happen sequentially and the order 
actually doesn't matter? Should I manually time the API executions to make 
the call? Should I writing things sequentially by default and only when 
hitting performance problems do I profile the program and wrap calls in 
goroutine?

How do you decide when to use goroutines?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to