Skip to content

Commit

Permalink
Merge pull request #14 from libp2p/nit/simple-reflect
Browse files Browse the repository at this point in the history
nit: avoid ValueOf
  • Loading branch information
magik6k committed Jun 27, 2019
2 parents 0fef0d6 + 1c05f12 commit 07e9677
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/host/eventbus/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 07e9677

Please sign in to comment.