Author | SHA1 | Message | Date |
---|---|---|---|
Anton Kaliaev |
4123d54bf6
|
change service#Start to return just error (Refs #45)
``` @melekes yeah, bool is superfluous @ethanfrey If I remember correctly when I was writing test code, if I call Start() on a Service that is already running, it returns (false, nil). Only if I try to legitimately start it, but it fails in startup do I get an error. The distinction is quite important to make it safe for reentrant calls. The other approach would be to have a special error type like ErrAlreadyStarted, then check for that in your code explicitly. Kind of like if I make a db call in gorm, and get an error, I check if it is a RecordNotFound error, or whether there was a real error with the db query. @melekes Ah, I see. Thanks. I must say I like ErrAlreadyStarted approach more (not just in Golang) ``` |
7 years ago |
Zach Ramsay | d6e03d2368 | linting: add to Makefile & do some fixes | 7 years ago |
Ethan Buchman | fe92e62a19 | merge go-events | 8 years ago |
Ethan Frey | a816ff0bab | Add test | 8 years ago |
Ethan Buchman | 1652dc8b3f | EventSwitch is an interface | 8 years ago |
Benjamin Bollen |
acabc4d3bb
|
Introduce events_test.go with five unit tests asserting normal behaviour
and a sixth unit test to probe race conditions on RemoveListener. |
9 years ago |