More panicky type assertions
This commit is contained in:
parent
5ccb42a0c7
commit
c745c791a5
1 changed files with 1 additions and 6 deletions
|
@ -57,12 +57,7 @@ func (p peerList) Len() int {
|
|||
}
|
||||
|
||||
func (p peerList) Less(i, j int) bool {
|
||||
if peer1, ok := p[i].(bencode.Dict); ok {
|
||||
if peer2, ok := p[j].(bencode.Dict); ok {
|
||||
return peer1["peer id"].(string) < peer2["peer id"].(string)
|
||||
}
|
||||
}
|
||||
return false
|
||||
return p[i].(bencode.Dict)["peer id"].(string) < p[j].(bencode.Dict)["peer id"].(string)
|
||||
}
|
||||
|
||||
func (p peerList) Swap(i, j int) {
|
||||
|
|
Loading…
Add table
Reference in a new issue