mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
Merge pull request #7335 from guggero/disable-gomnd
lint: disable gomnd
This commit is contained in:
commit
c38be044d3
8 changed files with 14 additions and 11 deletions
|
@ -184,6 +184,10 @@ linters:
|
||||||
# call t.Helper() within those functions, we lose the information where
|
# call t.Helper() within those functions, we lose the information where
|
||||||
# exactly a test failed in the generated failure stack trace.
|
# exactly a test failed in the generated failure stack trace.
|
||||||
- thelper
|
- thelper
|
||||||
|
|
||||||
|
# The linter is too aggressive and doesn't add much value since reviewers
|
||||||
|
# will also catch magic numbers that make sense to extract.
|
||||||
|
- gomnd
|
||||||
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
|
|
|
@ -1380,7 +1380,7 @@ func decodeCircuitKeys(r io.Reader, val interface{}, buf *[8]byte,
|
||||||
|
|
||||||
key.ChanID = lnwire.NewShortChanIDFromInt(scid)
|
key.ChanID = lnwire.NewShortChanIDFromInt(scid)
|
||||||
|
|
||||||
err := tlv.DUint64(r, &key.HtlcID, buf, 8) //nolint:gomnd,lll
|
err := tlv.DUint64(r, &key.HtlcID, buf, 8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1450,7 @@ func ampStateEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
|
||||||
keys := ampState.InvoiceKeys
|
keys := ampState.InvoiceKeys
|
||||||
numKeys := uint64(len(keys))
|
numKeys := uint64(len(keys))
|
||||||
size := tlv.VarIntSize(numKeys)
|
size := tlv.VarIntSize(numKeys)
|
||||||
dataSize := (numKeys * 16) //nolint:gomnd,lll
|
dataSize := (numKeys * 16)
|
||||||
|
|
||||||
return size + dataSize
|
return size + dataSize
|
||||||
},
|
},
|
||||||
|
|
|
@ -1653,7 +1653,6 @@ func clearLines(count int) {
|
||||||
|
|
||||||
// ordinalNumber returns the ordinal number as a string of a number.
|
// ordinalNumber returns the ordinal number as a string of a number.
|
||||||
func ordinalNumber(num uint32) string {
|
func ordinalNumber(num uint32) string {
|
||||||
//nolint:gomnd
|
|
||||||
switch num {
|
switch num {
|
||||||
case 1:
|
case 1:
|
||||||
return "1st"
|
return "1st"
|
||||||
|
|
|
@ -343,7 +343,8 @@ data.
|
||||||
* [`golangci-lint` will now check new code using additional
|
* [`golangci-lint` will now check new code using additional
|
||||||
linters](https://github.com/lightningnetwork/lnd/pull/7064) and was
|
linters](https://github.com/lightningnetwork/lnd/pull/7064) and was
|
||||||
[fine-tuned](https://github.com/lightningnetwork/lnd/pull/7289) to fit our
|
[fine-tuned](https://github.com/lightningnetwork/lnd/pull/7289) to fit our
|
||||||
code style.
|
code style or to [disable annoying new
|
||||||
|
linters](https://github.com/lightningnetwork/lnd/pull/7335).
|
||||||
|
|
||||||
* Update github actions to [check commits against the target base
|
* Update github actions to [check commits against the target base
|
||||||
branch](https://github.com/lightningnetwork/lnd/pull/7103) rather than just
|
branch](https://github.com/lightningnetwork/lnd/pull/7103) rather than just
|
||||||
|
|
|
@ -64,7 +64,7 @@ var (
|
||||||
|
|
||||||
testInvoiceDescription = "coffee"
|
testInvoiceDescription = "coffee"
|
||||||
|
|
||||||
testInvoiceAmount = lnwire.MilliSatoshi(100000) //nolint:gomnd
|
testInvoiceAmount = lnwire.MilliSatoshi(100000)
|
||||||
|
|
||||||
testNetParams = &chaincfg.MainNetParams
|
testNetParams = &chaincfg.MainNetParams
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ func generateInvoiceExpiryTestData(
|
||||||
for i := 1; i <= numExpired; i++ {
|
for i := 1; i <= numExpired; i++ {
|
||||||
var preimage lntypes.Preimage
|
var preimage lntypes.Preimage
|
||||||
binary.BigEndian.PutUint32(preimage[:4], uint32(offset+i))
|
binary.BigEndian.PutUint32(preimage[:4], uint32(offset+i))
|
||||||
duration := (i + offset) % 24 //nolint:gomnd
|
duration := (i + offset) % 24
|
||||||
expiry := time.Duration(duration) * time.Hour
|
expiry := time.Duration(duration) * time.Hour
|
||||||
invoice := newTestInvoice(
|
invoice := newTestInvoice(
|
||||||
t, preimage, expiredCreationDate, expiry,
|
t, preimage, expiredCreationDate, expiry,
|
||||||
|
@ -163,7 +163,7 @@ func generateInvoiceExpiryTestData(
|
||||||
for i := 1; i <= numPending; i++ {
|
for i := 1; i <= numPending; i++ {
|
||||||
var preimage lntypes.Preimage
|
var preimage lntypes.Preimage
|
||||||
binary.BigEndian.PutUint32(preimage[4:], uint32(offset+i))
|
binary.BigEndian.PutUint32(preimage[4:], uint32(offset+i))
|
||||||
duration := (i + offset) % 24 //nolint:gomnd
|
duration := (i + offset) % 24
|
||||||
expiry := time.Duration(duration) * time.Hour
|
expiry := time.Duration(duration) * time.Hour
|
||||||
invoice := newTestInvoice(t, preimage, now, expiry)
|
invoice := newTestInvoice(t, preimage, now, expiry)
|
||||||
testData.pendingInvoices[preimage.Hash()] = invoice
|
testData.pendingInvoices[preimage.Hash()] = invoice
|
||||||
|
|
|
@ -148,9 +148,8 @@ func migrateAckedUpdates(db kvdb.Backend, sessionsPerTx int) error {
|
||||||
|
|
||||||
// Calculate and log the progress if the progress is less than
|
// Calculate and log the progress if the progress is less than
|
||||||
// one hundred percent.
|
// one hundred percent.
|
||||||
//nolint:gomnd
|
|
||||||
progress := float64(migrated) / float64(total) * 100
|
progress := float64(migrated) / float64(total) * 100
|
||||||
if progress >= 100 { //nolint:gomnd
|
if progress >= 100 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ func (a *RangeIndex) lowerBoundIndex(n uint64) (int, bool) {
|
||||||
rangeIndex = -1
|
rangeIndex = -1
|
||||||
)
|
)
|
||||||
for {
|
for {
|
||||||
mid := (low + high) / 2 //nolint: gomnd
|
mid := (low + high) / 2
|
||||||
currentRange := a.set[mid]
|
currentRange := a.set[mid]
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|
|
@ -208,7 +208,7 @@ func (a *RangeIndex) lowerBoundIndex(n uint64) (int, bool) {
|
||||||
rangeIndex = -1
|
rangeIndex = -1
|
||||||
)
|
)
|
||||||
for {
|
for {
|
||||||
mid := (low + high) / 2 //nolint: gomnd
|
mid := (low + high) / 2
|
||||||
currentRange := a.set[mid]
|
currentRange := a.set[mid]
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|
Loading…
Add table
Reference in a new issue