From: Matt Joiner Date: Wed, 6 Mar 2024 11:50:03 +0000 (+1100) Subject: Tidy up X-Git-Tag: v1.56.0~58 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=be63f20170977d584b40d0afab3330b3ef045188;p=btrtrc.git Tidy up --- diff --git a/internal/cmd/issue-908/main.go b/internal/cmd/issue-908/main.go index a25447ba..96da2e8e 100644 --- a/internal/cmd/issue-908/main.go +++ b/internal/cmd/issue-908/main.go @@ -2,11 +2,12 @@ package main import ( "fmt" - "github.com/davecgh/go-spew/spew" "log" "net/http" "os" + "github.com/davecgh/go-spew/spew" + "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" diff --git a/peer_protocol/decoder.go b/peer_protocol/decoder.go index 49eda436..06d991e6 100644 --- a/peer_protocol/decoder.go +++ b/peer_protocol/decoder.go @@ -4,10 +4,10 @@ import ( "bufio" "encoding/binary" "fmt" - g "github.com/anacrolix/generics" "io" "sync" + g "github.com/anacrolix/generics" "github.com/pkg/errors" ) diff --git a/segments/index.go b/segments/index.go index d7ae744b..7ed30805 100644 --- a/segments/index.go +++ b/segments/index.go @@ -1,8 +1,9 @@ package segments import ( - g "github.com/anacrolix/generics" "sort" + + g "github.com/anacrolix/generics" ) func NewIndex(segments LengthIter) (ret Index) { diff --git a/segments/segments_test.go b/segments/segments_test.go index e757654f..ef165714 100644 --- a/segments/segments_test.go +++ b/segments/segments_test.go @@ -1,8 +1,9 @@ package segments import ( - qt "github.com/frankban/quicktest" "testing" + + qt "github.com/frankban/quicktest" ) func LengthIterFromSlice(ls []Length) LengthIter { diff --git a/storage/file-misc_test.go b/storage/file-misc_test.go index 9e97ce00..706fc210 100644 --- a/storage/file-misc_test.go +++ b/storage/file-misc_test.go @@ -1,14 +1,14 @@ package storage import ( - "github.com/anacrolix/torrent/common" - "github.com/anacrolix/torrent/segments" - qt "github.com/frankban/quicktest" "testing" + qt "github.com/frankban/quicktest" "github.com/stretchr/testify/assert" + "github.com/anacrolix/torrent/common" "github.com/anacrolix/torrent/metainfo" + "github.com/anacrolix/torrent/segments" ) type requiredLength struct { diff --git a/storage/file-piece.go b/storage/file-piece.go index 99ff5fc8..98fb806b 100644 --- a/storage/file-piece.go +++ b/storage/file-piece.go @@ -1,12 +1,12 @@ package storage import ( - "github.com/anacrolix/torrent/segments" "io" "log" "os" "github.com/anacrolix/torrent/metainfo" + "github.com/anacrolix/torrent/segments" ) type filePieceImpl struct { diff --git a/torrent.go b/torrent.go index b63b09fa..52515977 100644 --- a/torrent.go +++ b/torrent.go @@ -744,7 +744,7 @@ func (t *Torrent) pieceStateRuns() (ret PieceStateRuns) { }) }) for index := range t.pieces { - rle.Append(t.pieceState(pieceIndex(index)), 1) + rle.Append(t.pieceState(index), 1) } rle.Flush() return