DEV Community

Discussion on: gRPC quick start in Go

Collapse
 
dannypsnl profile image
林子篆

Not sure what happened on your computer, could you provide a sample for reproducing?

Collapse
 
ernsheong profile image
Jonathan ES Lin

Thanks for the reply. I figured it out. Gotta be careful with defer conn.Close() if calling outside main function... After function ends it will close the connection and the client cannot be used anymore.

Thread Thread
 
dannypsnl profile image
林子篆

Good to hear that; yes, better to using context if you want to manage the lifecycle. It provides a not bad abstraction for stopping a goroutine.