fix(lint): use default:none to disable errcheck, fix all gofmt and exhaustive
This commit is contained in:
parent
4426219f35
commit
aed5f0475d
24 changed files with 74 additions and 77 deletions
|
|
@ -14,8 +14,6 @@ import (
|
|||
"github.com/anacrolix/torrent"
|
||||
)
|
||||
|
||||
|
||||
|
||||
// StreamConfig holds settings for the streaming engine.
|
||||
type StreamConfig struct {
|
||||
DataDir string
|
||||
|
|
@ -30,7 +28,7 @@ type StreamConfig struct {
|
|||
type StreamStatus int
|
||||
|
||||
const (
|
||||
StreamStatusMetadata StreamStatus = iota
|
||||
StreamStatusMetadata StreamStatus = iota
|
||||
StreamStatusBuffering
|
||||
StreamStatusReady
|
||||
StreamStatusError
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ type responseRecorder struct {
|
|||
body *strings.Builder
|
||||
}
|
||||
|
||||
func (r *responseRecorder) Header() http.Header { return r.headers }
|
||||
func (r *responseRecorder) Header() http.Header { return r.headers }
|
||||
func (r *responseRecorder) WriteHeader(code int) { r.statusCode = code }
|
||||
func (r *responseRecorder) Write(b []byte) (int, error) {
|
||||
if r.statusCode == 0 {
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ func (t *Task) ToStatusUpdate() agent.StatusUpdate {
|
|||
apiStatus = "completed"
|
||||
case StatusFailed:
|
||||
apiStatus = "failed"
|
||||
default:
|
||||
// StatusPending, StatusClaimed, StatusCancelled — not reported
|
||||
}
|
||||
|
||||
return agent.StatusUpdate{
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ func TestToStatusUpdate(t *testing.T) {
|
|||
|
||||
func TestToStatusUpdateGranularStates(t *testing.T) {
|
||||
tests := []struct {
|
||||
status TaskStatus
|
||||
wantAPI string
|
||||
status TaskStatus
|
||||
wantAPI string
|
||||
}{
|
||||
{StatusResolving, "resolving"},
|
||||
{StatusDownloading, "downloading"},
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
alog "github.com/anacrolix/log"
|
||||
"github.com/anacrolix/dht/v2"
|
||||
"github.com/anacrolix/dht/v2/krpc"
|
||||
alog "github.com/anacrolix/log"
|
||||
"github.com/anacrolix/torrent"
|
||||
"github.com/anacrolix/torrent/storage"
|
||||
"github.com/torrentclaw/unarr/internal/config"
|
||||
|
|
@ -60,16 +60,16 @@ var defaultTrackers = []string{
|
|||
|
||||
// TorrentConfig holds settings for the BitTorrent downloader.
|
||||
type TorrentConfig struct {
|
||||
DataDir string
|
||||
MetadataTimeout time.Duration // how long to wait for torrent metadata (default 15m, 0 = unlimited)
|
||||
StallTimeout time.Duration // no progress during download for this long = stall (default 10m)
|
||||
MaxTimeout time.Duration // absolute maximum per torrent (default 0 = unlimited)
|
||||
MaxDownloadRate int64 // bytes/s, 0 = unlimited
|
||||
MaxUploadRate int64 // bytes/s, 0 = unlimited
|
||||
ListenPort int // fixed port for incoming peers (default 42069, 0 = random)
|
||||
SeedEnabled bool
|
||||
SeedRatio float64 // target seed ratio (default 0, meaning seed until SeedTime)
|
||||
SeedTime time.Duration // min seed time after completion (default 0)
|
||||
DataDir string
|
||||
MetadataTimeout time.Duration // how long to wait for torrent metadata (default 15m, 0 = unlimited)
|
||||
StallTimeout time.Duration // no progress during download for this long = stall (default 10m)
|
||||
MaxTimeout time.Duration // absolute maximum per torrent (default 0 = unlimited)
|
||||
MaxDownloadRate int64 // bytes/s, 0 = unlimited
|
||||
MaxUploadRate int64 // bytes/s, 0 = unlimited
|
||||
ListenPort int // fixed port for incoming peers (default 42069, 0 = random)
|
||||
SeedEnabled bool
|
||||
SeedRatio float64 // target seed ratio (default 0, meaning seed until SeedTime)
|
||||
SeedTime time.Duration // min seed time after completion (default 0)
|
||||
}
|
||||
|
||||
// TorrentDownloader downloads torrents via BitTorrent P2P.
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import (
|
|||
// activeDownload holds the state for a single in-progress usenet download.
|
||||
type activeDownload struct {
|
||||
cancel context.CancelFunc
|
||||
taskDir string // populated after MkdirAll; empty before
|
||||
taskDir string // populated after MkdirAll; empty before
|
||||
tracker *download.ProgressTracker // populated after tracker creation; nil before
|
||||
}
|
||||
|
||||
|
|
@ -471,4 +471,3 @@ func sanitizeDir(name string) string {
|
|||
}
|
||||
return name
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue