Golang buffered channel: Ignore/suppress sending repeated values

464 Views Asked by At

In golang from one go routine I'm posting message to a buffered channel. But my reader go routine may be little slow in processing, and any read from the channel may not happen faster. So to stop the channel buffer getting filled up I dont want the same data to be posted again in the buffered channel. Is there a way to do that?

1

There are 1 best solutions below

0
Volker On BEST ANSWER

Is there a way to do that?

No.

Channels (buffered or not) are opaque and you can do nothing but send or receive from them, they provide absolutely no further logic.