mirror of
https://github.com/libp2p/go-eventbus.git
synced 2025-03-13 10:20:10 +08:00
Merge pull request #14 from libp2p/nit/simple-reflect
nit: avoid ValueOf
This commit is contained in:
commit
0c299185af
6
basic.go
6
basic.go
@ -230,9 +230,9 @@ func newNode(typ reflect.Type) *node {
|
||||
}
|
||||
|
||||
func (n *node) emit(event interface{}) {
|
||||
eval := reflect.ValueOf(event)
|
||||
if eval.Type() != n.typ {
|
||||
panic(fmt.Sprintf("Emit called with wrong type. expected: %s, got: %s", n.typ, eval.Type()))
|
||||
typ := reflect.TypeOf(event)
|
||||
if typ != n.typ {
|
||||
panic(fmt.Sprintf("Emit called with wrong type. expected: %s, got: %s", n.typ, typ))
|
||||
}
|
||||
|
||||
n.lk.RLock()
|
||||
|
Loading…
Reference in New Issue
Block a user