build: adopt focused golangci-lint v2.13 checks
What changed, and why it matters
This commit is a routine build-maintenance change. It updates the project's Go linter configuration to a newer version and fixes the resulting style warnings: a WebSocket header spelling and several documentation comments that didn't start with the correct symbol names. There is no functional code change that affects security.
No security action required. Treat as normal build hygiene / linting cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit upgrades golangci-lint to v2.13 and enables/disables specific linters. It fixes one canonicalheader finding (Sec-WebSocket-Protocol header spelling) and multiple godoclint findings where doc comments now begin with the declared symbol name. All other changes are comment-only renames. No runtime logic, protocol behavior, or cryptographic handling is modified.
Changed components
.golangci.ymlchanstate/kv_open_channel.gocontractcourt/chain_arbitrator.golntest/harness.golntest/harness_assertion.golntest/node/config.golnwallet/chancloser/rbf_coop_transitions.gorecord/blinded_data.gosweep/fee_bumper.gosweep/sweeper.gozpay32/decode.goInspect captured patch +27 / −19
### .golangci.yml
@@ -69,6 +69,12 @@ linters:
# have no context to thread through, so it adds little value for now.
- noctx
+ # canonicalheader prefers registered initialism spellings such as
+ # Sec-WebSocket-Protocol, which can differ from the keys produced by
+ # net/http.CanonicalHeaderKey. Using those spellings as direct http.Header
+ # map keys can therefore break lookups.
+ - canonicalheader
+
# Disable whitespace linters as it has conflict rules against our
# contribution guidelines.
- wsl
@@ -126,7 +132,8 @@ linters:
# unit tests become our CI bottleneck.
- paralleltest
- # New linters that we haven't had time to address yet.
+ # New linters and expanded checks that we haven't had time to address yet.
+ - modernize
- testifylint
- perfsprint
- inamedparam
### chanstate/kv_open_channel.go
@@ -52,8 +52,8 @@ func FetchChannelDataLossCommitPoint(
}
const (
- // A tlv type definition used to serialize an outpoint's IndexStatus
- // for use in the outpoint index.
+ // IndexStatusType is a TLV type definition used to serialize an
+ // outpoint's IndexStatus for use in the outpoint index.
IndexStatusType tlv.Type = 0
)
### contractcourt/chain_arbitrator.go
@@ -1343,7 +1343,7 @@ func (c *ChainArbitrator) FindOutgoingHTLCDeadline(scid lnwire.ShortChannelID,
// TODO(roasbeef): arbitration reports
// * types: contested, waiting for success conf, etc
-// NOTE: part of the `chainio.Consumer` interface.
+// Name returns the name of the chain arbitrator consumer.
func (c *ChainArbitrator) Name() string {
return "ChainArbitrator"
}
### lntest/harness.go
@@ -781,8 +781,8 @@ func (h *HarnessTest) NewNodeWatchOnly(name string, extraArgs []string,
return hn
}
-// CreateNodeWatchOnly creates a new node and asserts its creation. The function
-// will only create the node and will not start it.
+// CreateNewNode creates a new node and asserts its creation. The function will
+// only create the node and will not start it.
func (h *HarnessTest) CreateNewNode(name string, extraArgs []string,
password []byte, noAuth bool) *node.HarnessNode {
@@ -2370,7 +2370,8 @@ func (h *HarnessTest) SendCoins(a, b *node.HarnessNode,
return tx
}
-// SendCoins sends all coins from node A to node B, returns the sending tx.
+// SendAllCoins sends all coins from node A to node B and returns the sending
+// transaction.
func (h *HarnessTest) SendAllCoins(a, b *node.HarnessNode) *wire.MsgTx {
// Create an address for Bob receive the coins.
req := &lnrpc.NewAddressRequest{
### lntest/harness_assertion.go
@@ -2011,8 +2011,8 @@ func (h *HarnessTest) AssertChannelInGraphCache(hn *node.HarnessNode,
return edge
}
-// AssertChannelInGraphDB asserts that a given channel is found both in the
-// graph db (GetChanInfo) and the graph cache (DescribeGraph).
+// AssertChannelInGraph asserts that a given channel is found both in the graph
+// db (GetChanInfo) and the graph cache (DescribeGraph).
func (h *HarnessTest) AssertChannelInGraph(hn *node.HarnessNode,
chanPoint *lnrpc.ChannelPoint) *lnrpc.ChannelEdge {
@@ -2947,8 +2947,8 @@ func (h *HarnessTest) AssertForceCloseAndAnchorTxnsInMempool() (*wire.MsgTx,
}
}
-// ReceiveSendToRouteUpdate waits until a message is received on the
-// PeerEventsClient stream or the timeout is reached.
+// ReceivePeerEvent waits until a message is received on the PeerEventsClient
+// stream or the timeout is reached.
func (h *HarnessTest) ReceivePeerEvent(
stream rpc.PeerEventsClient) (*lnrpc.PeerEvent, error) {
### lntest/node/config.go
@@ -73,7 +73,7 @@ var (
"--protocol.simple-taproot-chans",
}
- // CfgRbfCoopClose specifies the config used to create a node that
+ // CfgRbfClose specifies the config used to create a node that
// supports the new RBF close protocol.
CfgRbfClose = []string{
"--protocol.rbf-coop-close",
### lnwallet/chancloser/rbf_coop_transitions.go
@@ -25,7 +25,7 @@ import (
)
var (
- // ErrInvalidStateTransition is returned if the remote party tries to
+ // ErrThawHeightNotReached is returned if the remote party tries to
// close, but the thaw height hasn't been matched yet.
ErrThawHeightNotReached = fmt.Errorf("thaw height not reached")
)
### record/blinded_data.go
@@ -93,8 +93,8 @@ func NewNonFinalBlindedRouteData(chanID lnwire.ShortChannelID,
return info
}
-// NewNonFinalBlindedRouteData creates the data that's provided for hops within
-// a blinded route.
+// NewNonFinalBlindedRouteDataOnionMessage creates the data that's provided for
+// hops within a blinded route.
func NewNonFinalBlindedRouteDataOnionMessage(
nextNode fn.Either[*btcec.PublicKey, lnwire.ShortChannelID],
blindingOverride *btcec.PublicKey,
### sweep/fee_bumper.go
@@ -474,7 +474,7 @@ func (t *TxPublisher) updateRecord(r *monitorRecord,
return r
}
-// NOTE: part of the `chainio.Consumer` interface.
+// Name returns the name of the transaction publisher consumer.
func (t *TxPublisher) Name() string {
return "TxPublisher"
}
### sweep/sweeper.go
@@ -506,7 +506,7 @@ func (s *UtxoSweeper) Stop() error {
return nil
}
-// NOTE: part of the `chainio.Consumer` interface.
+// Name returns the name of the UTXO sweeper consumer.
func (s *UtxoSweeper) Name() string {
return "UtxoSweeper"
}
### zpay32/decode.go
@@ -32,8 +32,8 @@ var (
// not valid UTF-8.
ErrInvalidUTF8Description = errors.New("description is not valid UTF-8")
- // ErrLengthNotMultipleOfHopHintLength is returned if the length of the
- // route hint data is not a multiple of the hop hint length.
+ // ErrLengthNotMultipleOfHopHint is returned if the length of the route
+ // hint data is not a multiple of the hop hint length.
ErrLengthNotMultipleOfHopHint = errors.New("length is not a multiple " +
"of hop hint length")
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.