Re: [go-nuts] Using context package for goroutines cancellation is quite verbose

2020-06-10 Thread Jonathan Amsterdam
Typically, a network communication system, like gRPC for example, will accept contexts for network calls and turn context done-ness into an error. The typical signature of an RPC-backed function is func(context.Context, req *Request) (*Response, error) If the context times out or is

Re: [go-nuts] Using context package for goroutines cancellation is quite verbose

2020-06-09 Thread Yegor Roganov
Thanks Ian, it's nice to know that we're using Go correctly. I agree that more code doesn't really matter, and I think I'd be completely fine with this situation had there been a vet check that ensured that no selects are forgotten. Let's see if generics change something in this area. On

Re: [go-nuts] Using context package for goroutines cancellation is quite verbose

2020-06-08 Thread Ian Lance Taylor
On Mon, Jun 8, 2020 at 9:59 AM Yegor Roganov wrote: > > My team is developing a cloud-based data processing application, and a large > bulk of the application's job is doing network calls to other services. > Go's goroutines and channel-based communication are an excellent fit, but in > order

[go-nuts] Using context package for goroutines cancellation is quite verbose

2020-06-08 Thread Yegor Roganov
Hello, My team is developing a cloud-based data processing application, and a large bulk of the application's job is doing network calls to other services. Go's goroutines and channel-based communication are an excellent fit, but in order for the application to be able to properly shut down,