From 3602d90b652320a290f205b479e19b7758332359 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 22 Nov 2016 14:01:09 +1100 Subject: [PATCH] gofmt simplify --- client_test.go | 6 +++--- dht/krpc/msg_test.go | 2 +- fs/torrentfs_test.go | 2 +- tracker/udp_test.go | 2 +- util/dirwatch/dirwatch.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client_test.go b/client_test.go index 0835a976..7aad22f8 100644 --- a/client_test.go +++ b/client_test.go @@ -576,7 +576,7 @@ func TestCompletedPieceWrongSize(t *testing.T) { PieceLength: 15, Pieces: make([]byte, 20), Files: []metainfo.FileInfo{ - metainfo.FileInfo{Path: []string{"greeting"}, Length: 13}, + {Path: []string{"greeting"}, Length: 13}, }, } b, err := bencode.Marshal(info) @@ -993,7 +993,7 @@ func TestClientDynamicListenPortNoProtocols(t *testing.T) { func addClientPeer(t *Torrent, cl *Client) { t.AddPeers([]Peer{ - Peer{ + { IP: missinggo.AddrIP(cl.ListenAddr()), Port: missinggo.AddrPort(cl.ListenAddr()), }, @@ -1100,7 +1100,7 @@ func TestMultipleTorrentsWithEncryption(t *testing.T) { testutil.ExportStatusWriter(client, "c") tr, err := client.AddMagnet(magnet1) require.NoError(t, err) - tr.AddPeers([]Peer{Peer{ + tr.AddPeers([]Peer{{ IP: missinggo.AddrIP(server.ListenAddr()), Port: missinggo.AddrPort(server.ListenAddr()), }}) diff --git a/dht/krpc/msg_test.go b/dht/krpc/msg_test.go index 7b30cf02..d5e20407 100644 --- a/dht/krpc/msg_test.go +++ b/dht/krpc/msg_test.go @@ -59,7 +59,7 @@ func TestMarshalUnmarshalMsg(t *testing.T) { T: "\x8c%", R: &Return{ Values: []util.CompactPeer{ - util.CompactPeer{ + { IP: net.IPv4(1, 2, 3, 4).To4(), Port: 0x5678, }, diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index e77d63cd..53fcc400 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -186,7 +186,7 @@ func TestDownloadOnDemand(t *testing.T) { defer leecher.Close() leecherTorrent, _ := leecher.AddTorrent(layout.Metainfo) leecherTorrent.AddPeers([]torrent.Peer{ - torrent.Peer{ + { IP: missinggo.AddrIP(seeder.ListenAddr()), Port: missinggo.AddrPort(seeder.ListenAddr()), }, diff --git a/tracker/udp_test.go b/tracker/udp_test.go index df639dbd..4bff2f85 100644 --- a/tracker/udp_test.go +++ b/tracker/udp_test.go @@ -88,7 +88,7 @@ func TestAnnounceLocalhost(t *testing.T) { t.Parallel() srv := server{ t: map[[20]byte]torrent{ - [20]byte{0xa3, 0x56, 0x41, 0x43, 0x74, 0x23, 0xe6, 0x26, 0xd9, 0x38, 0x25, 0x4a, 0x6b, 0x80, 0x49, 0x10, 0xa6, 0x67, 0xa, 0xc1}: { + {0xa3, 0x56, 0x41, 0x43, 0x74, 0x23, 0xe6, 0x26, 0xd9, 0x38, 0x25, 0x4a, 0x6b, 0x80, 0x49, 0x10, 0xa6, 0x67, 0xa, 0xc1}: { Seeders: 1, Leechers: 2, Peers: []util.CompactPeer{ diff --git a/util/dirwatch/dirwatch.go b/util/dirwatch/dirwatch.go index 3c506637..4b71a2a6 100644 --- a/util/dirwatch/dirwatch.go +++ b/util/dirwatch/dirwatch.go @@ -169,7 +169,7 @@ func (i *Instance) torrentAdded(e entity) { func (i *Instance) refresh() { _new := scanDir(i.dirName) old := i.dirState - for ih, _ := range old { + for ih := range old { _, ok := _new[ih] if !ok { i.torrentRemoved(ih)