I'm writing a function that needs to run and finish as fast as possible.
It needs to make 3 REST calls and should any of these return a bad result, it needs to exit.
Each of the REST calls are being made in their own go routines and return the results to the main thread via a buffered channel.
Because I'm using buffered channels I know that the sending threads will send the results of the REST request via the buffered channel and exit - no possibility of a goroutine leak.
My question is; lets say I get the response from the first REST requests and it's a bad result (by which I mean the function as a whole needs exit), is it OK for me close the other two channels and exit without reading the contents of the other 2 buffered channels?
I have a feeling this isn't recommended and if that's they case why so?