diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5339538..12ee94e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -47,7 +47,7 @@ jobs: go-version: "^1.18" - uses: "golangci/golangci-lint-action@v3" with: - version: "v1.43" + version: "v1.45.2" skip-pkg-cache: true skip-build-cache: false diff --git a/bittorrent/params.go b/bittorrent/params.go index 20ece80..ec7e013 100644 --- a/bittorrent/params.go +++ b/bittorrent/params.go @@ -39,7 +39,7 @@ var ErrKeyNotFound = errors.New("query: value for the provided key does not exis // ErrInvalidInfohash is returned when parsing a query encounters an infohash // with invalid length. -//var ErrInvalidInfohash = ClientError("provided invalid infohash") +// var ErrInvalidInfohash = ClientError("provided invalid infohash") // ErrInvalidQueryEscape is returned when a query string contains invalid // escapes. diff --git a/middleware/hooks.go b/middleware/hooks.go index 03426ba..a535e68 100644 --- a/middleware/hooks.go +++ b/middleware/hooks.go @@ -77,14 +77,14 @@ type skipResponseHook struct{} // skip. var SkipResponseHookKey = skipResponseHook{} -//type scrapeAddressType struct{} +// type scrapeAddressType struct{} // ScrapeIsIPv6Key is the key under which to store whether or not the // address used to request a scrape was an IPv6 address. // The value is expected to be of type bool. // A missing value or a value that is not a bool for this key is equivalent to // it being set to false. -//var ScrapeIsIPv6Key = scrapeAddressType{} +// var ScrapeIsIPv6Key = scrapeAddressType{} type responseHook struct { store storage.Storage diff --git a/pkg/rand_seed/rand_seed.go b/pkg/rand_seed/rand_seed.go index fff59e2..1206caf 100644 --- a/pkg/rand_seed/rand_seed.go +++ b/pkg/rand_seed/rand_seed.go @@ -8,7 +8,7 @@ import ( ) func init() { - //Seeding global math random + // Seeding global math random rand.Seed(GenSeed()) } diff --git a/storage/memory/storage.go b/storage/memory/storage.go index b8ea7c0..9ab7e95 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -496,7 +496,7 @@ func asKey(in any) any { if reflect.TypeOf(in).Comparable() { return in } - //FIXME: dirty hack + // FIXME: dirty hack return fmt.Sprint(in) } diff --git a/storage/misc.go b/storage/misc.go index adeabe4..c28b96d 100644 --- a/storage/misc.go +++ b/storage/misc.go @@ -34,7 +34,8 @@ func (pk SerializedPeer) ToPeer() bittorrent.Peer { peer := bittorrent.Peer{ ID: peerID, Port: binary.BigEndian.Uint16([]byte(pk[bittorrent.PeerIDLen : bittorrent.PeerIDLen+2])), - IP: bittorrent.IP{IP: net.IP(pk[bittorrent.PeerIDLen+2:])}} + IP: bittorrent.IP{IP: net.IP(pk[bittorrent.PeerIDLen+2:])}, + } if ip := peer.IP.To4(); ip != nil { peer.IP.IP = ip diff --git a/storage/redis/storage.go b/storage/redis/storage.go index 06440a6..cea241c 100644 --- a/storage/redis/storage.go +++ b/storage/redis/storage.go @@ -573,7 +573,6 @@ func (ps *store) AnnouncePeers(ih bittorrent.InfoHash, seeder bool, numWant int, } func (ps *store) ScrapeSwarm(ih bittorrent.InfoHash, af bittorrent.AddressFamily) (resp bittorrent.Scrape) { - resp.InfoHash = ih addressFamily := af.String() encodedInfoHash := ih.String() @@ -816,7 +815,7 @@ func (ps *store) collectGarbage(cutoff time.Time) error { if ihLen == 0 { // Empty hashes are not shown among existing keys, // in other words, it's removed automatically after `HDEL` the last field. - //_, err := conn.Do("DEL", ihStr) + // _, err := conn.Do("DEL", ihStr) _ = conn.Send("MULTI") _ = conn.Send("HDEL", group, ihStr) diff --git a/storage/redis/storage_test.go b/storage/redis/storage_test.go index bf3c46b..081e060 100644 --- a/storage/redis/storage_test.go +++ b/storage/redis/storage_test.go @@ -23,7 +23,8 @@ func createNew() s.Storage { RedisBroker: redisURL, RedisReadTimeout: 10 * time.Second, RedisWriteTimeout: 10 * time.Second, - RedisConnectTimeout: 10 * time.Second}) + RedisConnectTimeout: 10 * time.Second, + }) if err != nil { panic(err) }