Merge pull request #741 from tendermint/client-compile-time-assertions

rpc/client: use compile time assertions instead of methods
This commit is contained in:
Ethan Buchman
2017-10-17 03:41:24 -04:00
committed by GitHub
5 changed files with 20 additions and 43 deletions

View File

@ -39,17 +39,12 @@ func NewHTTP(remote, wsEndpoint string) *HTTP {
}
}
func (c *HTTP) _assertIsClient() Client {
return c
}
func (c *HTTP) _assertIsNetworkClient() NetworkClient {
return c
}
func (c *HTTP) _assertIsEventSwitch() types.EventSwitch {
return c
}
var (
_ Client = (*HTTP)(nil)
_ NetworkClient = (*HTTP)(nil)
_ types.EventSwitch = (*HTTP)(nil)
_ types.EventSwitch = (*WSEvents)(nil)
)
func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
result := new(ctypes.ResultStatus)
@ -220,10 +215,6 @@ func newWSEvents(remote, endpoint string) *WSEvents {
}
}
func (w *WSEvents) _assertIsEventSwitch() types.EventSwitch {
return w
}
// Start is the only way I could think the extend OnStart from
// events.eventSwitch. If only it wasn't private...
// BaseService.Start -> eventSwitch.OnStart -> WSEvents.Start