# README
backtest
func (g *GoChannel) Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error) {
// ....
go func(s *subscriber, g *GoChannel) {
select {
case <-ctx.Done():
// unblock
case <-g.closing:
// unblock
}
s.Close()
// ....
}(s, g)
// ....
return s.outputChannel, nil
}
GoChannel.Close() 后,所有的 subscriber 也会被 close。