Skip to content

Commit 45a2f4e

Browse files
committed
fix linter warnings
1 parent 745f5dd commit 45a2f4e

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

internal/console/console.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@ func (c *Console) drawDetails(g *gocui.Gui) error {
582582
if t.NextAnnounce.IsZero() {
583583
nextAnnounce = "Unknown"
584584
} else {
585-
nextAnnounce = t.NextAnnounce.Time.Format(time.RFC3339)
585+
nextAnnounce = t.NextAnnounce.Format(time.RFC3339)
586586
}
587-
fmt.Fprintf(v, " Last announce: %s, Next announce: %s\n", t.LastAnnounce.Time.Format(time.RFC3339), nextAnnounce)
587+
fmt.Fprintf(v, " Last announce: %s, Next announce: %s\n", t.LastAnnounce.Format(time.RFC3339), nextAnnounce)
588588
}
589589
case peers:
590590
format := "%2s %21s %7s %8s %6s %s\n"
@@ -664,7 +664,7 @@ func (c *Console) updateTorrents(g *gocui.Gui) {
664664
if a.AddedAt.Equal(b.AddedAt.Time) {
665665
return a.ID < b.ID
666666
}
667-
return a.AddedAt.Time.Before(b.AddedAt.Time)
667+
return a.AddedAt.Before(b.AddedAt.Time)
668668
})
669669

670670
torrents := make([]Torrent, 0, len(rpcTorrents))
@@ -753,7 +753,7 @@ func (c *Console) updateDetails(g *gocui.Gui) {
753753
if a.ConnectedAt.Equal(b.ConnectedAt.Time) {
754754
return a.Addr < b.Addr
755755
}
756-
return a.ConnectedAt.Time.Before(b.ConnectedAt.Time)
756+
return a.ConnectedAt.Before(b.ConnectedAt.Time)
757757
})
758758
c.m.Lock()
759759
c.peers = peers

internal/metainfo/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func parsePrivateField(s bencode.RawMessage) bool {
221221
if err != nil {
222222
return true
223223
}
224-
return !(stringVal == "" || stringVal == "0")
224+
return stringVal != "" && stringVal != "0"
225225
}
226226

227227
// NewInfoBytes creates a new Info dictionary by reading and hashing the files on the disk.

rainrpc/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ func (c *Client) AddTorrent(f io.Reader, options *AddTorrentOptions) (*rpctypes.
7373
}
7474
args := rpctypes.AddTorrentRequest{Torrent: base64.StdEncoding.EncodeToString(b)}
7575
if options != nil {
76-
args.AddTorrentOptions.ID = options.ID
77-
args.AddTorrentOptions.Stopped = options.Stopped
78-
args.AddTorrentOptions.StopAfterDownload = options.StopAfterDownload
79-
args.AddTorrentOptions.StopAfterMetadata = options.StopAfterMetadata
76+
args.ID = options.ID
77+
args.Stopped = options.Stopped
78+
args.StopAfterDownload = options.StopAfterDownload
79+
args.StopAfterMetadata = options.StopAfterMetadata
8080
}
8181
var reply rpctypes.AddTorrentResponse
8282
return &reply.Torrent, c.client.Call("Session.AddTorrent", args, &reply)
@@ -86,10 +86,10 @@ func (c *Client) AddTorrent(f io.Reader, options *AddTorrentOptions) (*rpctypes.
8686
func (c *Client) AddURI(uri string, options *AddTorrentOptions) (*rpctypes.Torrent, error) {
8787
args := rpctypes.AddURIRequest{URI: uri}
8888
if options != nil {
89-
args.AddTorrentOptions.ID = options.ID
90-
args.AddTorrentOptions.Stopped = options.Stopped
91-
args.AddTorrentOptions.StopAfterDownload = options.StopAfterDownload
92-
args.AddTorrentOptions.StopAfterMetadata = options.StopAfterMetadata
89+
args.ID = options.ID
90+
args.Stopped = options.Stopped
91+
args.StopAfterDownload = options.StopAfterDownload
92+
args.StopAfterMetadata = options.StopAfterMetadata
9393
}
9494
var reply rpctypes.AddURIResponse
9595
return &reply.Torrent, c.client.Call("Session.AddURI", args, &reply)

torrent/session_rpc_handler.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func (h *rpcHandler) ListTorrents(args *rpctypes.ListTorrentsRequest, reply *rpc
4242
func (h *rpcHandler) AddTorrent(args *rpctypes.AddTorrentRequest, reply *rpctypes.AddTorrentResponse) error {
4343
r := base64.NewDecoder(base64.StdEncoding, strings.NewReader(args.Torrent))
4444
opt := &AddTorrentOptions{
45-
Stopped: args.AddTorrentOptions.Stopped,
46-
ID: args.AddTorrentOptions.ID,
45+
Stopped: args.Stopped,
46+
ID: args.ID,
4747
StopAfterDownload: args.StopAfterDownload,
4848
StopAfterMetadata: args.StopAfterMetadata,
4949
}
@@ -61,8 +61,8 @@ func (h *rpcHandler) AddTorrent(args *rpctypes.AddTorrentRequest, reply *rpctype
6161

6262
func (h *rpcHandler) AddURI(args *rpctypes.AddURIRequest, reply *rpctypes.AddURIResponse) error {
6363
opt := &AddTorrentOptions{
64-
Stopped: args.AddTorrentOptions.Stopped,
65-
ID: args.AddTorrentOptions.ID,
64+
Stopped: args.Stopped,
65+
ID: args.ID,
6666
StopAfterDownload: args.StopAfterDownload,
6767
StopAfterMetadata: args.StopAfterMetadata,
6868
}
@@ -398,8 +398,8 @@ func (h *rpcHandler) GetTorrentFileStats(args *rpctypes.GetTorrentFileStatsReque
398398
for i, s := range stats {
399399
reply.FileStats[i] = rpctypes.FileStats{
400400
File: rpctypes.File{
401-
Path: s.File.Path(),
402-
Length: s.File.Length(),
401+
Path: s.Path(),
402+
Length: s.Length(),
403403
},
404404
BytesCompleted: s.BytesCompleted,
405405
}

torrent/torrent_close.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (t *torrent) closePeer(pe *peer.Peer) {
4040
delete(t.incomingPeers, pe)
4141
delete(t.outgoingPeers, pe)
4242
delete(t.peerIDs, pe.ID)
43-
delete(t.connectedPeerIPs, pe.Conn.IP())
43+
delete(t.connectedPeerIPs, pe.IP())
4444
if t.piecePicker != nil {
4545
t.piecePicker.HandleDisconnect(pe)
4646
}

torrent/torrent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func TestTorrentFiles(t *testing.T) {
204204
assert.NoError(t, err)
205205
assert.Equal(t, 6, len(fileStats))
206206
assert.Equal(t, "sample_torrent/data/file1.bin", fileStats[0].Path())
207-
assert.Equal(t, int64(10240), fileStats[0].File.Length())
207+
assert.Equal(t, int64(10240), fileStats[0].Length())
208208
assert.Equal(t, int64(10240), fileStats[0].BytesCompleted)
209209
assert.Equal(t, int64(10485760), fileStats[2].BytesCompleted)
210210
assertCompleted(t, tor)

0 commit comments

Comments
 (0)