diff --git a/bittorrent/client_id_test.go b/bittorrent/client_id_test.go index c618143..e519616 100644 --- a/bittorrent/client_id_test.go +++ b/bittorrent/client_id_test.go @@ -5,7 +5,7 @@ import ( ) func TestClientID(t *testing.T) { - var clientTable = []struct{ peerID, clientID string }{ + clientTable := []struct{ peerID, clientID string }{ {"-AZ3034-6wfG2wk6wWLc", "AZ3034"}, {"-AZ3042-6ozMq5q6Q3NX", "AZ3042"}, {"-BS5820-oy4La2MWGEFj", "BS5820"}, diff --git a/bittorrent/event_test.go b/bittorrent/event_test.go index 10c9def..5dc83cb 100644 --- a/bittorrent/event_test.go +++ b/bittorrent/event_test.go @@ -8,7 +8,7 @@ import ( ) func TestNew(t *testing.T) { - var table = []struct { + table := []struct { data string expected Event expectedErr error diff --git a/frontend/http/bencode/encoder.go b/frontend/http/bencode/encoder.go index ce6d4f6..d9bcaa7 100644 --- a/frontend/http/bencode/encoder.go +++ b/frontend/http/bencode/encoder.go @@ -90,7 +90,7 @@ func marshal(w io.Writer, data interface{}) (err error) { err = marshalList(w, v) case []Dict: - var interfaceSlice = make([]interface{}, len(v)) + interfaceSlice := make([]interface{}, len(v)) for i, d := range v { interfaceSlice[i] = d } diff --git a/frontend/http/writer_test.go b/frontend/http/writer_test.go index f677752..3c98906 100644 --- a/frontend/http/writer_test.go +++ b/frontend/http/writer_test.go @@ -11,7 +11,7 @@ import ( ) func TestWriteError(t *testing.T) { - var table = []struct { + table := []struct { reason, expected string }{ {"hello world", "d14:failure reason11:hello worlde"}, @@ -29,7 +29,7 @@ func TestWriteError(t *testing.T) { } func TestWriteStatus(t *testing.T) { - var table = []struct { + table := []struct { reason, expected string }{ {"something is missing", "d14:failure reason20:something is missinge"}, diff --git a/storage/redis/peer_store_test.go b/storage/redis/peer_store_test.go index 305927a..72d2a06 100644 --- a/storage/redis/peer_store_test.go +++ b/storage/redis/peer_store_test.go @@ -23,7 +23,8 @@ func createNew() s.PeerStore { RedisBroker: redisURL, RedisReadTimeout: 10 * time.Second, RedisWriteTimeout: 10 * time.Second, - RedisConnectTimeout: 10 * time.Second}) + RedisConnectTimeout: 10 * time.Second, + }) if err != nil { panic(err) } diff --git a/storage/redis/redis.go b/storage/redis/redis.go index e1d7e4b..fccf941 100644 --- a/storage/redis/redis.go +++ b/storage/redis/redis.go @@ -80,7 +80,7 @@ func (rc *redisConnector) NewPool() *redis.Pool { // Open a new Redis connection func (rc *redisConnector) open() (redis.Conn, error) { - var opts = []redis.DialOption{ + opts := []redis.DialOption{ redis.DialDatabase(rc.URL.DB), redis.DialReadTimeout(rc.ReadTimeout), redis.DialWriteTimeout(rc.WriteTimeout), @@ -119,7 +119,7 @@ func parseRedisURL(target string) (*redisURL, error) { return nil, errors.New("no redis scheme found") } - db := 0 //default redis db + db := 0 // default redis db parts := strings.Split(u.Path, "/") if len(parts) != 1 { db, err = strconv.Atoi(parts[1])