Skip to content

Commit 0c0ad20

Browse files
committed
multi: enforce 80-char line length and add nolint:lll comments
- Updated `.golangci.yml` to enforce a maximum line length of 80 characters. - Reformatted code comments and function parameters to adhere to the new line-length restriction. - Added `nolint: lll` comments where line wrapping was not applicable.
1 parent a1ef642 commit 0c0ad20

File tree

20 files changed

+70
-31
lines changed

20 files changed

+70
-31
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ linters-settings:
2020
gofmt:
2121
# simplify code: gofmt with `-s` option, true by default
2222
simplify: true
23+
lll:
24+
# Max line length, lines longer will be reported.
25+
line-length: 80
2326
tagliatelle:
2427
case:
2528
rules:

accounts/tlv.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ func PaymentEntryMapEncoder(w io.Writer, val any, buf *[8]byte) error {
227227
}
228228

229229
// PaymentEntryMapDecoder decodes a map of payment entries.
230-
func PaymentEntryMapDecoder(r io.Reader, val any, buf *[8]byte, _ uint64) error {
230+
func PaymentEntryMapDecoder(r io.Reader, val any, buf *[8]byte,
231+
_ uint64) error {
232+
231233
if typ, ok := val.(*AccountPayments); ok {
232234
numItems, err := tlv.ReadVarInt(r, buf)
233235
if err != nil {

autopilotserver/mock/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ func rulesToRPC(rulesMap map[string]*RuleRanges) (
436436
return res, nil
437437
}
438438

439-
func permissionsToRPC(ps map[string][]bakery.Op) []*autopilotserverrpc.Permissions {
439+
func permissionsToRPC(
440+
ps map[string][]bakery.Op) []*autopilotserverrpc.Permissions {
441+
440442
res := make([]*autopilotserverrpc.Permissions, len(ps))
441443

442444
for method, ops := range ps {

config.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,16 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
583583

584584
defaultTapCfg := tapcfg.DefaultConfig()
585585
if cfg.tapRemote && cfg.Network != DefaultNetwork {
586-
if cfg.Remote.TaprootAssets.MacaroonPath == defaultTapCfg.RpcConf.MacaroonPath {
586+
if cfg.Remote.TaprootAssets.MacaroonPath ==
587+
defaultTapCfg.RpcConf.MacaroonPath {
588+
587589
macaroonPath := cfg.TaprootAssets.RpcConf.MacaroonPath
588590
cfg.Remote.TaprootAssets.MacaroonPath = macaroonPath
589591
}
590-
if cfg.Remote.TaprootAssets.TLSCertPath == defaultTapCfg.RpcConf.TLSCertPath {
591-
tlsCertPath := cfg.TaprootAssets.RpcConf.TLSCertPath
592+
if cfg.Remote.TaprootAssets.TLSCertPath ==
593+
defaultTapCfg.RpcConf.TLSCertPath {
592594

595+
tlsCertPath := cfg.TaprootAssets.RpcConf.TLSCertPath
593596
cfg.Remote.TaprootAssets.TLSCertPath = tlsCertPath
594597
}
595598
}

firewall/privacy_mapper_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@ func TestPrivacyMapper(t *testing.T) {
2727
}
2828

2929
// Define some transaction outpoints used for mapping.
30-
clearTxID := "abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"
30+
clearTxID :=
31+
"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"
3132
clearTxIDReveresed, err := chainhash.NewHashFromStr(clearTxID)
3233
require.NoError(t, err)
3334

34-
obfusTxID0 := "097ef666a61919ff3413b3b701eae3a5cbac08f70c0ca567806e1fa6acbfe384"
35+
obfusTxID0 :=
36+
"097ef666a61919ff3413b3b701eae3a5cbac08f70c0ca567806e1fa6acbfe384"
3537
require.NoError(t, err)
3638
obfusOut0 := uint32(2161781494)
3739
obfusTxID0Reversed, err := chainhash.NewHashFromStr(obfusTxID0)
3840
require.NoError(t, err)
3941

40-
obfusTxID1 := "45ec471bfccb0b7b9a8bc4008248931c59ad994903e07b54f54821ea3ef5cc5c"
42+
obfusTxID1 :=
43+
"45ec471bfccb0b7b9a8bc4008248931c59ad994903e07b54f54821ea3ef5cc5c"
4144
obfusOut1 := uint32(1642614131)
4245

4346
clearPending := &lnrpc.PendingChannelsResponse_PendingChannel{
@@ -554,6 +557,7 @@ func TestPrivacyMapper(t *testing.T) {
554557
name: "PendingChannels Response",
555558
uri: "/lnrpc.Lightning/PendingChannels",
556559
msgType: rpcperms.TypeResponse,
560+
// nolint: lll
557561
msg: &lnrpc.PendingChannelsResponse{
558562
PendingOpenChannels: []*lnrpc.PendingChannelsResponse_PendingOpenChannel{
559563
{
@@ -595,6 +599,7 @@ func TestPrivacyMapper(t *testing.T) {
595599
},
596600
},
597601
},
602+
//nolint:lll
598603
expectedReplacement: &lnrpc.PendingChannelsResponse{
599604
PendingOpenChannels: []*lnrpc.PendingChannelsResponse_PendingOpenChannel{
600605
{

firewalldb/actions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ func (s *groupActionsReadDB) ListActions(ctx context.Context) ([]*RuleAction,
318318
return actions, nil
319319
}
320320

321-
// groupFeatureActionsReadDB is an implementation of the rules.ActionsListDB that
322-
// will provide read access to all the Actions of a feature within a particular
323-
// group.
321+
// groupFeatureActionsReadDB is an implementation of the rules.ActionsListDB
322+
// that will provide read access to all the Actions of a feature within a
323+
// particular group.
324324
type groupFeatureActionsReadDB struct {
325325
*allActionsReadDB
326326
}

firewalldb/actions_kvdb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const (
3232
typeLocatorActionID tlv.Type = 2
3333
)
3434

35+
// nolint: lll
3536
/*
3637
The Actions are stored in the following structure in the KV db:
3738

firewalldb/kvstores_kvdb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"go.etcd.io/bbolt"
99
)
1010

11+
// nolint:lll
1112
/*
1213
The KVStores are stored in the following structure in the KV db. Note that
1314
the `perm` and `temp` buckets are identical in structure. The only difference

itest/litd_node.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ func (hn *HarnessNode) InvoiceMacPath() string {
637637
return hn.Cfg.InvoiceMacPath
638638
}
639639

640-
// renameFile is a helper to rename (log) files created during integration tests.
640+
// renameFile is a helper to rename (log) files created during integration
641+
// tests.
641642
func renameFile(fromFileName, toFileName string) {
642643
err := os.Rename(fromFileName, toFileName)
643644
if err != nil {
@@ -1803,7 +1804,9 @@ func (hn *HarnessNode) WaitForBlockchainSync(ctx context.Context) error {
18031804

18041805
// WaitForBalance waits until the node sees the expected confirmed/unconfirmed
18051806
// balance within their wallet.
1806-
func (hn *HarnessNode) WaitForBalance(expectedBalance btcutil.Amount, confirmed bool) error {
1807+
func (hn *HarnessNode) WaitForBalance(expectedBalance btcutil.Amount,
1808+
confirmed bool) error {
1809+
18071810
ctx := context.Background()
18081811
req := &lnrpc.WalletBalanceRequest{}
18091812

itest/network_harness.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ func (n *NetworkHarness) OpenChannel(srcNode, destNode *HarnessNode,
10101010
}
10111011
}
10121012

1013-
// OpenPendingChannel attempts to open a channel between srcNode and destNode with the
1014-
// passed channel funding parameters. If the passed context has a timeout, then
1015-
// if the timeout is reached before the channel pending notification is
1016-
// received, an error is returned.
1013+
// OpenPendingChannel attempts to open a channel between srcNode and destNode
1014+
// with the passed channel funding parameters. If the passed context has a
1015+
// timeout, then if the timeout is reached before the channel pending
1016+
// notification is received, an error is returned.
10171017
func (n *NetworkHarness) OpenPendingChannel(srcNode, destNode *HarnessNode,
10181018
amt btcutil.Amount,
10191019
pushAmt btcutil.Amount) (*lnrpc.PendingUpdate, error) {
@@ -1080,7 +1080,8 @@ func (n *NetworkHarness) OpenPendingChannel(srcNode, destNode *HarnessNode,
10801080
// has a timeout, then if the timeout is reached before the channel has been
10811081
// opened, then an error is returned.
10821082
func (n *NetworkHarness) WaitForChannelOpen(
1083-
openChanStream lnrpc.Lightning_OpenChannelClient) (*lnrpc.ChannelPoint, error) {
1083+
openChanStream lnrpc.Lightning_OpenChannelClient) (*lnrpc.ChannelPoint,
1084+
error) {
10841085

10851086
ctxb := context.Background()
10861087
ctx, cancel := context.WithTimeout(ctxb, wait.ChannelOpenTimeout)

0 commit comments

Comments
 (0)