feat(GODT-3160): make linter happy

This commit is contained in:
Jakub
2024-01-24 10:22:43 +01:00
parent 1cd35defe5
commit 374194c13b
5 changed files with 14 additions and 9 deletions

View File

@ -63,13 +63,17 @@ func (c *eventCollector) collectFrom(eventCh <-chan events.Event) <-chan events.
}
func awaitType[T events.Event](c *eventCollector, ofType T, timeout time.Duration) (T, bool) {
if event := c.await(ofType, timeout); event == nil {
event := c.await(ofType, timeout)
if event == nil {
return *new(T), false //nolint:gocritic
} else if event, ok := event.(T); !ok {
panic(fmt.Errorf("unexpected event type %T", event))
} else {
return event, true
}
if eventT, ok := event.(T); !ok {
return eventT, true
}
panic(fmt.Errorf("unexpected event type %T", event))
}
func (c *eventCollector) await(ofType events.Event, timeout time.Duration) events.Event {