mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
Merge pull request #6270 from guggero/enable-whitespace-linter
ci: enable whitespace linter
This commit is contained in:
commit
0aa0831619
@ -83,10 +83,6 @@ linters:
|
||||
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
|
||||
- errorlint
|
||||
|
||||
# Has an issue (https://github.com/ultraware/whitespace/issues/6) but will
|
||||
# want to enable this in the future.
|
||||
- whitespace
|
||||
|
||||
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
|
||||
- interfacer
|
||||
- golint
|
||||
|
@ -1463,7 +1463,6 @@ func (d *DB) InvoicesSettledSince(sinceSettleIndex uint64) ([]Invoice, error) {
|
||||
seqNo, indexValue := invoiceCursor.Next()
|
||||
|
||||
for ; seqNo != nil && bytes.Compare(seqNo, startIndex[:]) > 0; seqNo, indexValue = invoiceCursor.Next() {
|
||||
|
||||
// Depending on the length of the index value, this may
|
||||
// or may not be an AMP invoice, so we'll extract the
|
||||
// invoice value into two components: the invoice num,
|
||||
|
@ -81,8 +81,8 @@ func MigrateFwdPkgCleanup(tx kvdb.RwTx) error {
|
||||
|
||||
// Otherwise, wipe all the forwarding packages.
|
||||
if err := fwdPkgBkt.DeleteNestedBucket(
|
||||
sourceBytes[:]); err != nil {
|
||||
|
||||
sourceBytes[:],
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -615,9 +615,8 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
err := kvdb.Update(db,
|
||||
func(tx walletdb.ReadWriteTx) error {
|
||||
|
||||
err := kvdb.Update(
|
||||
db, func(tx walletdb.ReadWriteTx) error {
|
||||
var seqNrBytes [8]byte
|
||||
byteOrder.PutUint64(
|
||||
seqNrBytes[:], test.sequenceNumber,
|
||||
@ -627,7 +626,8 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
||||
tx, test.paymentHash, seqNrBytes[:],
|
||||
)
|
||||
return err
|
||||
}, func() {})
|
||||
}, func() {},
|
||||
)
|
||||
require.Equal(t, test.expectedErr, err)
|
||||
})
|
||||
}
|
||||
|
@ -179,6 +179,7 @@ func newTestBoltArbLog(chainhash chainhash.Hash,
|
||||
testArbCfg := ChannelArbitratorConfig{
|
||||
PutResolverReport: func(_ kvdb.RwTx,
|
||||
_ *channeldb.ResolverReport) error {
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@ -383,6 +383,7 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
|
||||
},
|
||||
MarkChannelClosed: func(*channeldb.ChannelCloseSummary,
|
||||
...channeldb.ChannelStatus) error {
|
||||
|
||||
return nil
|
||||
},
|
||||
IsPendingClose: false,
|
||||
@ -1635,6 +1636,7 @@ func TestChannelArbitratorCommitFailure(t *testing.T) {
|
||||
chanArb.cfg.MarkChannelClosed = func(
|
||||
*channeldb.ChannelCloseSummary,
|
||||
...channeldb.ChannelStatus) error {
|
||||
|
||||
close(closed)
|
||||
return nil
|
||||
}
|
||||
@ -2169,6 +2171,7 @@ func TestRemoteCloseInitiator(t *testing.T) {
|
||||
// about setting of channel status.
|
||||
mockMarkClosed := func(_ *channeldb.ChannelCloseSummary,
|
||||
statuses ...channeldb.ChannelStatus) error {
|
||||
|
||||
for _, status := range statuses {
|
||||
err := alice.State().ApplyChanStatus(status)
|
||||
if err != nil {
|
||||
|
@ -62,6 +62,7 @@ func newHtlcResolverTestContext(t *testing.T,
|
||||
Sweeper: newMockSweeper(),
|
||||
IncubateOutputs: func(wire.OutPoint, *lnwallet.OutgoingHtlcResolution,
|
||||
*lnwallet.IncomingHtlcResolution, uint32) error {
|
||||
|
||||
return nil
|
||||
},
|
||||
DeliverResolutionMsg: func(msgs ...ResolutionMsg) error {
|
||||
@ -86,6 +87,7 @@ func newHtlcResolverTestContext(t *testing.T,
|
||||
// this so set nolint directive.
|
||||
checkpointFunc := func(c ContractResolver, // nolint
|
||||
r ...*channeldb.ResolverReport) error {
|
||||
|
||||
return testCtx.checkpoint(c, r...)
|
||||
}
|
||||
|
||||
@ -253,6 +255,7 @@ func TestHtlcSuccessSecondStageResolution(t *testing.T) {
|
||||
// to resolve our htlc.
|
||||
preCheckpoint: func(ctx *htlcResolverTestContext,
|
||||
_ bool) error {
|
||||
|
||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: sweepTx,
|
||||
SpenderTxHash: &sweepHash,
|
||||
|
@ -861,6 +861,7 @@ func TestHtlcTimeoutSecondStageRemoteSpend(t *testing.T) {
|
||||
// success transcation.
|
||||
preCheckpoint: func(ctx *htlcResolverTestContext,
|
||||
_ bool) error {
|
||||
|
||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: remoteSuccessTx,
|
||||
SpenderTxHash: &successTxid,
|
||||
|
@ -100,9 +100,14 @@
|
||||
|
||||
* [The `golangci-lint` package was updated and new linters were
|
||||
enabled](https://github.com/lightningnetwork/lnd/pull/6244).
|
||||
**Note to developers**: please make sure you delete the old version of
|
||||
`golangci-lint` in your `$GOPATH/bin` directory. `make lint` does not
|
||||
automatically replace it with the new version if the binary already exists!
|
||||
|
||||
* The linting process now runs [inside a docker
|
||||
container](https://github.com/lightningnetwork/lnd/pull/6248) to fix
|
||||
versioning issues between projects.
|
||||
|
||||
* The [`whitespace` linter](https://github.com/lightningnetwork/lnd/pull/6270)
|
||||
was enabled to make sure multi-line `if` conditions and function/method
|
||||
declarations are followed by an empty line to improve readability.
|
||||
|
||||
# Contributors (Alphabetical Order)
|
||||
|
||||
|
@ -208,6 +208,7 @@ func newMailboxContext(t *testing.T, startTime time.Time,
|
||||
ctx.mailbox = newMemoryMailBox(&mailBoxConfig{
|
||||
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
||||
*lnwire.ChannelUpdate, error) {
|
||||
|
||||
return &lnwire.ChannelUpdate{
|
||||
ShortChannelID: sid,
|
||||
}, nil
|
||||
@ -671,12 +672,14 @@ func TestMailOrchestrator(t *testing.T) {
|
||||
mo := newMailOrchestrator(&mailOrchConfig{
|
||||
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
||||
*lnwire.ChannelUpdate, error) {
|
||||
|
||||
return &lnwire.ChannelUpdate{
|
||||
ShortChannelID: sid,
|
||||
}, nil
|
||||
},
|
||||
forwardPackets: func(_ chan struct{},
|
||||
pkts ...*htlcPacket) error {
|
||||
|
||||
return nil
|
||||
},
|
||||
clock: clock.NewTestClock(time.Now()),
|
||||
|
@ -70,7 +70,6 @@ func lockInputs(w lnwallet.WalletController, packet *psbt.Packet) (
|
||||
if err := w.ReleaseOutput(
|
||||
LndInternalLockID, op,
|
||||
); err != nil {
|
||||
|
||||
log.Errorf("could not release the "+
|
||||
"lock on %v: %v", op, err)
|
||||
}
|
||||
|
@ -297,6 +297,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// response to a channel balance RPC.
|
||||
checkChannelBalance := func(node *lntest.HarnessNode,
|
||||
local, remote, pendingLocal, pendingRemote btcutil.Amount) {
|
||||
|
||||
expectedResponse := &lnrpc.ChannelBalanceResponse{
|
||||
LocalBalance: &lnrpc.Amount{
|
||||
Sat: uint64(local),
|
||||
|
@ -614,8 +614,8 @@ func createTestGraphFromChannels(useCache bool, testChannels []*testChannel,
|
||||
|
||||
for _, testChannel := range testChannels {
|
||||
for _, node := range []*testChannelEnd{
|
||||
testChannel.Node1, testChannel.Node2} {
|
||||
|
||||
testChannel.Node1, testChannel.Node2,
|
||||
} {
|
||||
_, exists := aliasMap[node.Alias]
|
||||
if !exists {
|
||||
var features *lnwire.FeatureVector
|
||||
|
@ -779,7 +779,6 @@ func (p *shardHandler) handleSendError(attempt *channeldb.HTLCAttemptInfo,
|
||||
if err := p.router.cfg.Control.Fail(
|
||||
p.identifier, *reason,
|
||||
); err != nil {
|
||||
|
||||
log.Errorf("unable to report failure to control "+
|
||||
"tower: %v", err)
|
||||
|
||||
|
@ -670,7 +670,6 @@ func TestSendPaymentErrorFeeInsufficientPrivateEdge(t *testing.T) {
|
||||
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||
|
||||
if firstHop != roasbeefSongoku || errorReturned {
|
||||
return preImage, nil
|
||||
}
|
||||
@ -685,7 +684,8 @@ func TestSendPaymentErrorFeeInsufficientPrivateEdge(t *testing.T) {
|
||||
Update: errChanUpdate,
|
||||
}, 1,
|
||||
)
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
// Send off the payment request to the router, route through son
|
||||
// goku and then across the private channel to elst.
|
||||
@ -802,7 +802,6 @@ func TestSendPaymentPrivateEdgeUpdateFeeExceedsLimit(t *testing.T) {
|
||||
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||
|
||||
if firstHop != roasbeefSongoku || errorReturned {
|
||||
return preImage, nil
|
||||
}
|
||||
@ -817,7 +816,8 @@ func TestSendPaymentPrivateEdgeUpdateFeeExceedsLimit(t *testing.T) {
|
||||
Update: errChanUpdate,
|
||||
}, 1,
|
||||
)
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
// Send off the payment request to the router, route through son
|
||||
// goku and then across the private channel to elst.
|
||||
@ -3071,7 +3071,6 @@ func TestSendToRouteMultiShardSend(t *testing.T) {
|
||||
|
||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||
|
||||
// Signal that the shard has been initiated and is
|
||||
// waiting for a result.
|
||||
waitForResultSignal <- struct{}{}
|
||||
@ -3082,7 +3081,8 @@ func TestSendToRouteMultiShardSend(t *testing.T) {
|
||||
return [32]byte{}, fmt.Errorf("failure")
|
||||
}
|
||||
return res, nil
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
// Launch three shards by calling SendToRoute in three goroutines,
|
||||
// returning their final error on the channel.
|
||||
|
@ -1653,7 +1653,6 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
||||
if err := r.server.ConnectToPeer(
|
||||
peerAddr, in.Perm, timeout,
|
||||
); err != nil {
|
||||
|
||||
rpcsLog.Errorf(
|
||||
"[connectpeer]: error connecting to peer: %v", err,
|
||||
)
|
||||
|
@ -11,3 +11,6 @@ require (
|
||||
github.com/rinchsan/gosimports v0.1.5
|
||||
github.com/stephens2424/writerset v1.0.2 // indirect
|
||||
)
|
||||
|
||||
// Can be removed once this version is included in golangci-lint.
|
||||
replace github.com/ultraware/whitespace => github.com/ultraware/whitespace v0.0.5
|
||||
|
@ -859,8 +859,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA=
|
||||
github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
|
||||
github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg=
|
||||
github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA=
|
||||
github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI=
|
||||
github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/uudashr/gocognit v1.0.5 h1:rrSex7oHr3/pPLQ0xoWq108XMU8s678FJcQ+aSfOHa4=
|
||||
|
Loading…
Reference in New Issue
Block a user