refactor: no need defer in closeAll
@@ -138,10 +138,10 @@ func (e *Exchange) Subscribe(ctx context.Context, fs ...string) (ch <-chan *even
)
closeAll := func() {
- defer close(errq)
- defer e.broadcaster.Remove(dst)
- defer queue.Close()
- defer channel.Close()
+ channel.Close()
+ queue.Close()
+ e.broadcaster.Remove(dst)
+ close(errq)
}
ch = evch
