mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-13 08:38:36 -07:00
More panicky type assertions
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user