Apply some lints from GoLand

This commit is contained in:
Matt Joiner 2021-10-06 18:43:15 +11:00
parent 11ae25660a
commit 118391c3bf
3 changed files with 6 additions and 13 deletions

11
go.mod
View File

@ -1,5 +1,7 @@
module github.com/anacrolix/torrent
go 1.17
require (
bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508
@ -29,6 +31,7 @@ require (
github.com/frankban/quicktest v1.13.1
github.com/fsnotify/fsnotify v1.5.1
github.com/google/btree v1.0.1
github.com/google/go-cmp v0.5.6
github.com/gorilla/websocket v1.4.2
github.com/jessevdk/go-flags v1.5.0
github.com/pion/datachannel v1.4.21
@ -44,7 +47,6 @@ require (
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
require (
@ -53,7 +55,6 @@ require (
github.com/anacrolix/stm v0.3.0 // indirect
github.com/benbjohnson/immutable v0.3.0 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/kr/pretty v0.3.0 // indirect
@ -78,14 +79,12 @@ require (
github.com/willf/bitset v1.1.11 // indirect
github.com/willf/bloom v2.0.3+incompatible // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
go 1.17
exclude (
bazil.org/fuse v0.0.0-20200419173433-3ba628eaf417
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05
github.com/willf/bitset v1.2.0
)
exclude github.com/willf/bitset v1.2.0

6
go.sum
View File

@ -44,14 +44,10 @@ github.com/alexflint/go-arg v1.4.2/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf
github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw=
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/anacrolix/args v0.1.0 h1:gcDj4DgjLhe+f311XqQ8eC6wYyKhZocxXUTeDvezAJ0=
github.com/anacrolix/args v0.1.0/go.mod h1:RCPBt2vU1GJn4gG9rL+fuYu7ivnE9tmK2pHm63t3yO0=
github.com/anacrolix/args v0.1.1-0.20210917054839-725094dd33fe h1:YvHyQkMwxP4OdUnudTu6HaU6WqW25ShNgXtUEWjN/tc=
github.com/anacrolix/args v0.1.1-0.20210917054839-725094dd33fe/go.mod h1:RCPBt2vU1GJn4gG9rL+fuYu7ivnE9tmK2pHm63t3yO0=
github.com/anacrolix/chansync v0.0.0-20210524073341-a336ebc2de92/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
github.com/anacrolix/chansync v0.1.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
github.com/anacrolix/chansync v0.1.1-0.20210904130811-9cd7139c8dd9 h1:Jk3Mdr+XbO1uvf/+nUXjb/M1dPDNPQThxKmS5MLGE+w=
github.com/anacrolix/chansync v0.1.1-0.20210904130811-9cd7139c8dd9/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
github.com/anacrolix/chansync v0.2.1-0.20210910114620-14955c95ded9 h1:jfSupvl9p7Bkd9snD6DrjxDmsYjJeYxSqhQa/I9wV3I=
github.com/anacrolix/chansync v0.2.1-0.20210910114620-14955c95ded9/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
github.com/anacrolix/confluence v1.7.1-0.20210221224747-9cb14aa2c53a/go.mod h1:T0JHvSaf9UfoiUdCtCOUuRroHm/tauUJTbLc6/vd5YA=
@ -124,8 +120,6 @@ github.com/anacrolix/multiless v0.0.0-20210222022749-ef43011a77ec/go.mod h1:TrCL
github.com/anacrolix/multiless v0.1.1-0.20210520040635-10ee7b5f3cff/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
github.com/anacrolix/multiless v0.1.1-0.20210529082330-de2f6cf29619 h1:ZkusP2EHxvxm+IymiKJ8DBVE/E6fJkb8K/2+GXZpjAY=
github.com/anacrolix/multiless v0.1.1-0.20210529082330-de2f6cf29619/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
github.com/anacrolix/squirrel v0.1.0 h1:Zz7XUFUr2ozhsTvzwLdmrFpduoTHtBNTB/KZQ4Ivh00=
github.com/anacrolix/squirrel v0.1.0/go.mod h1:YzgVvikMdFD441oTWlNG189bpKabO9Sbf3uCSVgca04=
github.com/anacrolix/squirrel v0.1.1-0.20210914065657-81bc5ecdc43a h1:8LAUQgDPqnzuF/WrGQzTY6i+bVO/FpA90Hi6jXA+2vQ=
github.com/anacrolix/squirrel v0.1.1-0.20210914065657-81bc5ecdc43a/go.mod h1:YzgVvikMdFD441oTWlNG189bpKabO9Sbf3uCSVgca04=
github.com/anacrolix/stm v0.1.0/go.mod h1:ZKz7e7ERWvP0KgL7WXfRjBXHNRhlVRlbBQecqFtPq+A=

View File

@ -67,7 +67,7 @@ func (d *Decoder) Decode(msg *Message) (err error) {
}
length -= 8
dataLen := int64(length)
msg.Piece = (*d.Pool.Get().(*[]byte))
msg.Piece = *d.Pool.Get().(*[]byte)
if int64(cap(msg.Piece)) < dataLen {
return errors.New("piece data longer than expected")
}