package event type System struct { busList []*eventBus } func NewSystem() *System { return &System{[]*eventBus{}} } func (s *System) NewBus() Bus { evtBus := &eventBus{s, map[string]*[]HandlerFunc{}} s.busList = append(s.busList, evtBus) return evtBus } func (s *System) RemoveBus(bus Bus) { where := -1 for i, b := range s.busList { if b == bus { // Pointer comparison somehow? where = i break } } s.busList = append(s.busList[:where], s.busList[where+1:]...) } func (s *System) handleEvent(evt Event) { // Pass this event trough all buses for _, bus := range s.busList { bus.handleEvent(evt) } }