If I understand what you're trying to do, I'd approach it this way, using a
generously buffered channel and discarding the extras at the consumer, as
shown below, instead of at the producer:
result <- c // wait for result to appear
for len(c) > 0 {
// there is a newer result available
result <- c
}
// process latest available result
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/e2da4c3a-7b51-4b12-9b15-cc553ea68e0cn%40googlegroups.com.