Apply ineffassign linter
This commit is contained in:
parent
82ee860e8d
commit
f83771b660
@ -1366,7 +1366,7 @@ func (me *Client) connectionLoop(t *Torrent, c *connection) error {
|
||||
break
|
||||
}
|
||||
var pexMsg peerExchangeMessage
|
||||
err := bencode.Unmarshal(msg.ExtendedPayload, &pexMsg)
|
||||
err = bencode.Unmarshal(msg.ExtendedPayload, &pexMsg)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error unmarshalling PEX message: %s", err)
|
||||
break
|
||||
@ -1412,7 +1412,7 @@ func (me *Client) connectionLoop(t *Torrent, c *connection) error {
|
||||
if msg.Port != 0 {
|
||||
pingAddr.Port = int(msg.Port)
|
||||
}
|
||||
_, err = me.dHT.Ping(pingAddr)
|
||||
me.dHT.Ping(pingAddr)
|
||||
default:
|
||||
err = fmt.Errorf("received unknown message type: %#v", msg.Type)
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ func TestAnnounceTimeout(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
a, err := s.Announce("12341234123412341234", 0, true)
|
||||
assert.NoError(t, err)
|
||||
<-a.Peers
|
||||
a.Close()
|
||||
s.Close()
|
||||
|
@ -173,7 +173,6 @@ func TestDownloadOnDemand(t *testing.T) {
|
||||
// the torrent to the seeder by magnet.
|
||||
DisableMetainfoCache: true,
|
||||
})
|
||||
seeder.SetIPBlockList(nil)
|
||||
require.NoError(t, err)
|
||||
defer seeder.Close()
|
||||
testutil.ExportStatusWriter(seeder, "s")
|
||||
@ -189,7 +188,7 @@ func TestDownloadOnDemand(t *testing.T) {
|
||||
// with the same ID.
|
||||
// PeerID: seeder.PeerID(),
|
||||
})
|
||||
leecher.SetIPBlockList(nil)
|
||||
require.NoError(t, err)
|
||||
testutil.ExportStatusWriter(leecher, "l")
|
||||
defer leecher.Close()
|
||||
leecherTorrent, _ := leecher.AddTorrent(layout.Metainfo)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package metainfo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
@ -9,6 +8,7 @@ import (
|
||||
|
||||
"github.com/anacrolix/missinggo"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/anacrolix/torrent/bencode"
|
||||
)
|
||||
@ -38,10 +38,8 @@ func testFile(t *testing.T, filename string) {
|
||||
// }
|
||||
|
||||
b, err := bencode.Marshal(mi.Info)
|
||||
if !bytes.Equal(b, mi.Info.Bytes) {
|
||||
t.Logf("\n%q\n%q", b[len(b)-20:], mi.Info.Bytes[len(mi.Info.Bytes)-20:])
|
||||
t.Fatal("encoded and decoded bytes don't match")
|
||||
}
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, b, mi.Info.Bytes)
|
||||
}
|
||||
|
||||
func TestFile(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user