asaskevich / EventBus

[Go] Lightweight eventbus with async compatibility for Go
MIT License
1.74k stars 220 forks source link

Remove boilerplate in subscribe functions #14

Closed borgstrom closed 9 years ago

borgstrom commented 9 years ago

This moves all of the repeated code from each of the public subscribe functions into a single private function. I believe it makes the API simpler overall and easier to read.

gofmt updated all of the spacing in the file, so you can look directly at commit e7eac98 for the actual changes.

Thanks for this bit of code! It's exactly what I need and very easy to understand.

(PS. This should also get the test coverage to 100%)

borgstrom commented 9 years ago

I'm unable to replicate that failure... I'm going to close and reopen this to see if it was transient.

borgstrom commented 9 years ago

Re-opening.

borgstrom commented 9 years ago

That's weird... I wonder why the async test failed in this job: https://travis-ci.org/asaskevich/EventBus/jobs/83501296

bennAH commented 9 years ago

may require taking a look at the test.