From 5c1c00ae151ab3e4e94d7e6fbff7825e444e8792 Mon Sep 17 00:00:00 2001 From: Aitor Perez <1515757+Zerpet@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:18:54 +0000 Subject: [PATCH] Add warning to Connection.Channel go-doc --- connection.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/connection.go b/connection.go index 127bb2d..ede7e8e 100644 --- a/connection.go +++ b/connection.go @@ -897,6 +897,10 @@ func (c *Connection) closeChannel(ch *Channel, e *Error) { Channel opens a unique, concurrent server channel to process the bulk of AMQP messages. Any error from methods on this receiver will render the receiver invalid and a new Channel should be opened. + +Channels are not thread-safe. To avoid unexpected behavior, do not share +a single Channel instance between multiple goroutines. Concurrent calls +to Channel methods may result in race conditions or unpredictable outcomes. */ func (c *Connection) Channel() (*Channel, error) { return c.openChannel()