Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify ECLog switch statement #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,17 @@ func parseRawJSONEventsFromSamples(data []byte) ([]json.RawMessage, error) {
}

func ECLog(e Event) string {
// XXX: this feels like the wrong way; can't figure out the right way
switch e.(type) {
switch t := e.(type) {
case *Bounce:
b := e.(*Bounce)
return b.ECLog()
return t.ECLog()
case *Delay:
d := e.(*Delay)
return d.ECLog()
return t.ECLog()
case *Delivery:
d := e.(*Delivery)
return d.ECLog()
return t.ECLog()
case *Injection:
i := e.(*Injection)
return i.ECLog()
return t.ECLog()
case *OutOfBand:
o := e.(*OutOfBand)
return o.ECLog()
return t.ECLog()
}
return ""
}
Expand Down