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 {
|
func (p peerList) Less(i, j int) bool {
|
||||||
if peer1, ok := p[i].(bencode.Dict); ok {
|
return p[i].(bencode.Dict)["peer id"].(string) < p[j].(bencode.Dict)["peer id"].(string)
|
||||||
if peer2, ok := p[j].(bencode.Dict); ok {
|
|
||||||
return peer1["peer id"].(string) < peer2["peer id"].(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p peerList) Swap(i, j int) {
|
func (p peerList) Swap(i, j int) {
|
||||||
|
|
Loading…
Reference in a new issue