From 0e85ff190d3bffec05fa70bdd55ffbd2b1611456 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 2 Feb 2016 00:44:29 +1100 Subject: [PATCH] go vet --- cmd/torrent-pick/main.go | 2 +- dht/msg_test.go | 10 +++++++--- metainfo/metainfo.go | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/torrent-pick/main.go b/cmd/torrent-pick/main.go index c41e1a07..5389e384 100644 --- a/cmd/torrent-pick/main.go +++ b/cmd/torrent-pick/main.go @@ -91,7 +91,7 @@ func main() { parser.Usage = "[OPTIONS] (magnet URI or .torrent file path)..." posArgs, err := parser.Parse() if err != nil { - fmt.Fprintln(os.Stderr, "Download from the BitTorrent network.\n") + fmt.Fprintf(os.Stderr, "%s", "Download from the BitTorrent network.\n\n") fmt.Println(err) os.Exit(2) } diff --git a/dht/msg_test.go b/dht/msg_test.go index 1f1aeb3e..7c846234 100644 --- a/dht/msg_test.go +++ b/dht/msg_test.go @@ -4,10 +4,11 @@ import ( "net" "testing" - "github.com/anacrolix/torrent/bencode" - "github.com/anacrolix/torrent/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/anacrolix/torrent/bencode" + "github.com/anacrolix/torrent/util" ) func testMarshalUnmarshalMsg(t *testing.T, m Msg, expected string) { @@ -71,7 +72,10 @@ func TestMarshalUnmarshalMsg(t *testing.T) { R: &Return{ ID: "\xeb\xff6isQ\xffJ\xec)ͺ\xab\xf2\xfb\xe3F|\xc2g", }, - IP: util.CompactPeer{net.IPv4(124, 168, 180, 8).To4(), 62844}, + IP: util.CompactPeer{ + IP: net.IPv4(124, 168, 180, 8).To4(), + Port: 62844, + }, }, "d2:ip6:|\xa8\xb4\b\xf5|1:rd2:id20:\xeb\xff6isQ\xffJ\xec)ͺ\xab\xf2\xfb\xe3F|\xc2ge1:t1:\x031:y1:re") } diff --git a/metainfo/metainfo.go b/metainfo/metainfo.go index deb936a2..ad674887 100644 --- a/metainfo/metainfo.go +++ b/metainfo/metainfo.go @@ -92,12 +92,12 @@ func (info *Info) writeFiles(w io.Writer, open func(fi FileInfo) (io.ReadCloser, for _, fi := range info.UpvertedFiles() { r, err := open(fi) if err != nil { - return fmt.Errorf("error opening %s: %s", fi, err) + return fmt.Errorf("error opening %v: %s", fi, err) } wn, err := io.CopyN(w, r, fi.Length) r.Close() if wn != fi.Length || err != nil { - return fmt.Errorf("error hashing %s: %s", fi, err) + return fmt.Errorf("error hashing %v: %s", fi, err) } } return nil