From 06383d1a2e417002f8d5d74afc9e1e26b849997b Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Sun, 30 Dec 2018 08:25:03 +0300 Subject: [PATCH] stylistic changes --- cmd/magneticod/bittorrent/metadata/leech_test.go | 3 ++- cmd/magneticod/dht/mainline/codec.go | 6 ++++-- cmd/magneticow/api.go | 2 +- cmd/magneticow/main_test.go | 2 -- pkg/util/util.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/magneticod/bittorrent/metadata/leech_test.go b/cmd/magneticod/bittorrent/metadata/leech_test.go index c32ca1e..25b2bf7 100644 --- a/cmd/magneticod/bittorrent/metadata/leech_test.go +++ b/cmd/magneticod/bittorrent/metadata/leech_test.go @@ -2,8 +2,9 @@ package metadata import ( "bytes" - "github.com/anacrolix/torrent/bencode" "testing" + + "github.com/anacrolix/torrent/bencode" ) var operationsTest_instances = []struct { diff --git a/cmd/magneticod/dht/mainline/codec.go b/cmd/magneticod/dht/mainline/codec.go index e951a20..768be3c 100644 --- a/cmd/magneticod/dht/mainline/codec.go +++ b/cmd/magneticod/dht/mainline/codec.go @@ -8,13 +8,15 @@ package mainline import ( "encoding/binary" "fmt" - "github.com/pkg/errors" "net" + "github.com/pkg/errors" + + "regexp" + "github.com/anacrolix/missinggo/iter" "github.com/anacrolix/torrent/bencode" "github.com/willf/bloom" - "regexp" ) type Message struct { diff --git a/cmd/magneticow/api.go b/cmd/magneticow/api.go index aba6bf3..c89ee5e 100644 --- a/cmd/magneticow/api.go +++ b/cmd/magneticow/api.go @@ -48,7 +48,7 @@ func apiTorrentsHandler(w http.ResponseWriter, r *http.Request) { return } - if tq.LastID != nil && *tq.LastID < 0 { + if tq.LastID == nil { respondError(w, 400, "lastID has to be greater than or equal to zero") return } diff --git a/cmd/magneticow/main_test.go b/cmd/magneticow/main_test.go index 1d4fce1..b4023c3 100644 --- a/cmd/magneticow/main_test.go +++ b/cmd/magneticow/main_test.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "testing" ) @@ -113,5 +112,4 @@ func TestSchemaRequired(t *testing.T) { if err == nil { t.Error("err is nil") } - fmt.Printf(err.Error()) } diff --git a/pkg/util/util.go b/pkg/util/util.go index eff2728..9c070a1 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -8,4 +8,4 @@ import ( func HexField(key string, val []byte) zapcore.Field { return zapcore.Field{Key: key, Type: zapcore.StringType, String: hex.EncodeToString(val)} -} \ No newline at end of file +}