Skip to content

Commit

Permalink
Merge pull request #7173 from yyforyongyu/update-linter
Browse files Browse the repository at this point in the history
golangci: update linter to fix linter bug
  • Loading branch information
guggero authored Nov 18, 2022
2 parents 43ff90a + 84fd911 commit 87ca48f
Show file tree
Hide file tree
Showing 38 changed files with 253 additions and 161 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ linters:
- ifshort
- varcheck
- deadcode
- nosnakecase

# Disable gofumpt as it has weird behavior regarding formatting multiple
# lines for a function which is in conflict with our contribution
Expand Down
2 changes: 1 addition & 1 deletion channeldb/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ func syncNewChannel(tx kvdb.RwTx, c *OpenChannel, addrs []net.Addr) error {
// occur. This method its to be called when we revoke our prior commitment
// state.
//
// A map is returned of all the htlc resolutions that were locked in in this
// A map is returned of all the htlc resolutions that were locked in this
// commitment. Keys correspond to htlc indices and values indicate whether the
// htlc was settled or failed.
func (c *OpenChannel) UpdateCommitment(newCommitment *ChannelCommitment,
Expand Down
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ var (
// See LoadConfig for further details regarding the configuration
// loading+parsing process.
//
// nolint:lll
//nolint:lll
type Config struct {
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`

Expand Down Expand Up @@ -465,7 +465,7 @@ type Config struct {

// DefaultConfig returns all default values for the Config struct.
//
// nolint:lll
//nolint:lll
func DefaultConfig() Config {
return Config{
LndDir: DefaultLndDir,
Expand Down
2 changes: 1 addition & 1 deletion contractcourt/mock_htlcnotifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ type mockHTLCNotifier struct {
}

func (m *mockHTLCNotifier) NotifyFinalHtlcEvent(key channeldb.CircuitKey,
info channeldb.FinalHtlcInfo) { // nolint:whitespace
info channeldb.FinalHtlcInfo) { //nolint:whitespace
}
2 changes: 1 addition & 1 deletion docs/release-notes/release-notes-0.16.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
### Tooling and documentation

* [The `golangci-lint` tool was updated to
`v1.46.2`](https://github.com/lightningnetwork/lnd/pull/6731)
`v1.50.1`](https://github.com/lightningnetwork/lnd/pull/7173)

* [Tests in `htlcswitch` will now clean up the temporary resources they create](https://github.com/lightningnetwork/lnd/pull/6832).

Expand Down
4 changes: 2 additions & 2 deletions htlcswitch/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5249,7 +5249,7 @@ func TestChannelLinkFail(t *testing.T) {
c.cfg.Peer.(*mockPeer).disconnected = true
},
func(*testing.T, *channelLink,
*lnwallet.LightningChannel) { // nolint:whitespace,lll
*lnwallet.LightningChannel) { //nolint:whitespace,lll

// Should fail at startup.
},
Expand All @@ -5269,7 +5269,7 @@ func TestChannelLinkFail(t *testing.T) {
c.channel.State().Packager = pkg
},
func(*testing.T, *channelLink,
*lnwallet.LightningChannel) { // nolint:whitespace,lll
*lnwallet.LightningChannel) { //nolint:whitespace,lll

// Should fail at startup.
},
Expand Down
2 changes: 1 addition & 1 deletion htlcswitch/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,5 @@ func (h *mockHTLCNotifier) NotifySettleEvent(key HtlcKey,
}

func (h *mockHTLCNotifier) NotifyFinalHtlcEvent(key channeldb.CircuitKey,
info channeldb.FinalHtlcInfo) { // nolint:whitespace
info channeldb.FinalHtlcInfo) { //nolint:whitespace
}
2 changes: 1 addition & 1 deletion kvdb/etcd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "fmt"

// Config holds etcd configuration alongside with configuration related to our higher level interface.
//
// nolint:lll
//nolint:lll
type Config struct {
Embedded bool `long:"embedded" description:"Use embedded etcd instance instead of the external one. Note: use for testing only."`

Expand Down
2 changes: 1 addition & 1 deletion kvdb/postgres/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "time"

// Config holds postgres configuration data.
//
// nolint:lll
//nolint:lll
type Config struct {
Dsn string `long:"dsn" description:"Database connection string."`
Timeout time.Duration `long:"timeout" description:"Database connection timeout. Set to zero to disable."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package lncfg

// AutoPilot holds the configuration options for the daemon's autopilot.
//
// nolint:lll
//nolint:lll
type AutoPilot struct {
Active bool `long:"active" description:"If the autopilot agent should be active or not."`
Heuristic map[string]float64 `long:"heuristic" description:"Heuristic to activate, and the weight to give it during scoring."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/bitcoind.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "time"
// Bitcoind holds the configuration options for the daemon's connection to
// bitcoind.
//
// nolint:lll
//nolint:lll
type Bitcoind struct {
Dir string `long:"dir" description:"The base directory that contains the node's data, logs, configuration file, etc."`
ConfigPath string `long:"config" description:"Configuration filepath. If not set, will default to the default filename under 'dir'."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/btcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package lncfg

// Btcd holds the configuration options for the daemon's connection to btcd.
//
// nolint:lll
//nolint:lll
type Btcd struct {
Dir string `long:"dir" description:"The base directory that contains the node's data, logs, configuration file, etc."`
RPCHost string `long:"rpchost" description:"The daemon's rpc listening address. If a port is omitted, then the default port for the selected chain parameters will be used."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (

// Caches holds the configuration for various caches within lnd.
//
// nolint:lll
//nolint:lll
type Caches struct {
// RejectCacheSize is the maximum number of entries stored in lnd's
// reject cache, which is used for efficiently rejecting gossip updates.
Expand Down
2 changes: 1 addition & 1 deletion lncfg/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// Chain holds the configuration options for the daemon's chain settings.
//
// nolint:lll
//nolint:lll
type Chain struct {
Active bool `long:"active" description:"If the chain should be active or not."`
ChainDir string `long:"chaindir" description:"The directory to store the chain's data within."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const (

// DB holds database configuration for LND.
//
// nolint:lll
//nolint:lll
type DB struct {
Backend string `long:"backend" description:"The selected database backend."`

Expand Down
2 changes: 1 addition & 1 deletion lncfg/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/lightningnetwork/lnd/routing/route"
)

// nolint:lll
//nolint:lll
type Gossip struct {
PinnedSyncersRaw []string `long:"pinned-syncers" description:"A set of peers that should always remain in an active sync state, which can be used to closely synchronize the routing tables of two nodes. The value should be comma separated list of hex-encoded pubkeys. Connected peers matching this pubkey will remain active for the duration of the connection and not count towards the NumActiveSyncer count."`

Expand Down
2 changes: 1 addition & 1 deletion lncfg/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
// HealthCheckConfig contains the configuration for the different health checks
// the lnd runs.
//
// nolint:lll
//nolint:lll
type HealthCheckConfig struct {
ChainCheck *CheckConfig `group:"chainbackend" namespace:"chainbackend"`

Expand Down
2 changes: 1 addition & 1 deletion lncfg/htlcswitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
MaxMailboxDeliveryTimeout = 2 * time.Minute
)

// nolint:lll
//nolint:lll
type Htlcswitch struct {
MailboxDeliveryTimeout time.Duration `long:"mailboxdeliverytimeout" description:"The timeout value when delivering HTLCs to a channel link. Setting this value too small will result in local payment failures if large number of payments are sent over a short period."`
}
Expand Down
2 changes: 1 addition & 1 deletion lncfg/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DefaultHoldInvoiceExpiryDelta = DefaultIncomingBroadcastDelta + 2

// Invoices holds the configuration options for invoices.
//
// nolint:lll
//nolint:lll
type Invoices struct {
HoldExpiryDelta uint32 `long:"holdexpirydelta" description:"The number of blocks before a hold invoice's htlc expires that the invoice should be canceled to prevent a force close. Force closes will not be prevented if this value is not greater than DefaultIncomingBroadcastDelta."`
}
2 changes: 1 addition & 1 deletion lncfg/monitoring_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package lncfg
// Prometheus is the set of configuration data that specifies the listening
// address of the Prometheus exporter.
//
// nolint:lll
//nolint:lll
type Prometheus struct {
// Listen is the listening address that we should use to allow the main
// Prometheus server to scrape our metrics.
Expand Down
2 changes: 1 addition & 1 deletion lncfg/neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "time"
// Neutrino holds the configuration options for the daemon's connection to
// neutrino.
//
// nolint:lll
//nolint:lll
type Neutrino struct {
AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package lncfg
// compatibility of protocol additions, while defaulting to the latest within
// lnd, or to enable experimental protocol changes.
//
// nolint:lll
//nolint:lll
type ProtocolOptions struct {
// LegacyProtocol is a sub-config that houses all the legacy protocol
// options. These are mostly used for integration tests as most modern
Expand Down
2 changes: 1 addition & 1 deletion lncfg/protocol_legacy_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package lncfg
// are mostly used for integration tests as most modern nodes should always run
// with them on by default.
//
// nolint:lll
//nolint:lll
type LegacyProtocol struct {
// LegacyOnionFormat if set to true, then we won't signal
// TLVOnionPayloadOptional. As a result, nodes that include us in the
Expand Down
2 changes: 1 addition & 1 deletion lncfg/protocol_rpctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package lncfg
// compatibility of protocol additions, while defaulting to the latest within
// lnd, or to enable experimental protocol changes.
//
// nolint:lll
//nolint:lll
type ProtocolOptions struct {
// LegacyProtocol is a sub-config that houses all the legacy protocol
// options. These are mostly used for integration tests as most modern
Expand Down
2 changes: 1 addition & 1 deletion lncfg/remotesigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (

// RemoteSigner holds the configuration options for a remote RPC signer.
//
// nolint:lll
//nolint:lll
type RemoteSigner struct {
Enable bool `long:"enable" description:"Use a remote signer for signing any on-chain related transactions or messages. Only recommended if local wallet is initialized as watch-only. Remote signer must use the same seed/root key as the local watch-only wallet but must have private keys."`
RPCHost string `long:"rpchost" description:"The remote signer's RPC host:port"`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package lncfg

// Routing holds the configuration options for routing.
//
// nolint:lll
//nolint:lll
type Routing struct {
AssumeChannelValid bool `long:"assumechanvalid" description:"Skip checking channel spentness during graph validation. This speedup comes at the risk of using an unvalidated view of the network for routing. (default: false)"`

Expand Down
2 changes: 1 addition & 1 deletion lncfg/rpcmiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (

// RPCMiddleware holds the configuration for RPC interception middleware.
//
// nolint:lll
//nolint:lll
type RPCMiddleware struct {
Enable bool `long:"enable" description:"Enable the RPC middleware interceptor functionality."`
InterceptTimeout time.Duration `long:"intercepttimeout" description:"Time after which a RPC middleware intercept request will time out and return an error if it hasn't yet received a response."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"
)

// nolint:lll
//nolint:lll
type Sweeper struct {
BatchWindowDuration time.Duration `long:"batchwindowduration" description:"Duration of the sweep batch window. The sweep is held back during the batch window to allow more inputs to be added and thereby lower the fee per input."`
}
Expand Down
2 changes: 1 addition & 1 deletion lncfg/tor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package lncfg

// Tor holds the configuration options for the daemon's connection to tor.
//
// nolint:lll
//nolint:lll
type Tor struct {
Active bool `long:"active" description:"Allow outbound and inbound connections to be routed through Tor"`
SOCKS string `long:"socks" description:"The host:port that Tor's exposed SOCKS5 proxy is listening on"`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/watchtower.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/lightningnetwork/lnd/watchtower"
// Watchtower holds the daemon specific configuration parameters for running a
// watchtower that shares resources with the daemon.
//
// nolint:lll
//nolint:lll
type Watchtower struct {
Active bool `long:"active" description:"If the watchtower should be active or not"`

Expand Down
2 changes: 1 addition & 1 deletion lncfg/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
// Workers exposes CLI configuration for turning resources consumed by worker
// pools.
//
// nolint:lll
//nolint:lll
type Workers struct {
// Read is the maximum number of concurrent read pool workers.
Read int `long:"read" description:"Maximum number of concurrent read pool workers. This number should be proportional to the number of peers."`
Expand Down
2 changes: 1 addition & 1 deletion lncfg/wtclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "fmt"

// WtClient holds the configuration options for the daemon's watchtower client.
//
// nolint:lll
//nolint:lll
type WtClient struct {
// Active determines whether a watchtower client should be created to
// back up channel states with registered watchtowers.
Expand Down
1 change: 0 additions & 1 deletion lntemp/harness_assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,6 @@ func (h *HarnessTest) AssertAllTxesSpendFrom(txes []*wire.MsgTx,
}

// AssertTxSpendFrom asserts that a given tx is spent from a previous tx.
// tx.
func (h *HarnessTest) AssertTxSpendFrom(tx *wire.MsgTx,
prevTxid chainhash.Hash) {

Expand Down
6 changes: 3 additions & 3 deletions lntemp/rpc/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type (
AnnResp *peersrpc.NodeAnnouncementUpdateResponse
)

// UpdateNodeAnnouncement makes an UpdateNodeAnnouncement RPC call the the
// peersrpc client and asserts.
// UpdateNodeAnnouncement makes an UpdateNodeAnnouncement RPC call the peersrpc
// client and asserts.
func (h *HarnessRPC) UpdateNodeAnnouncement(req AnnReq) AnnResp {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
Expand All @@ -28,7 +28,7 @@ func (h *HarnessRPC) UpdateNodeAnnouncement(req AnnReq) AnnResp {
return resp
}

// UpdateNodeAnnouncementErr makes an UpdateNodeAnnouncement RPC call the the
// UpdateNodeAnnouncementErr makes an UpdateNodeAnnouncement RPC call the
// peersrpc client and asserts an error is returned.
func (h *HarnessRPC) UpdateNodeAnnouncementErr(req AnnReq) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
IsForwardedHTLC: s.htlcSwitch.IsForwardedHTLC,
Clock: clock.NewDefaultClock(),
SubscribeBreachComplete: s.breachArbiter.SubscribeBreachComplete,
PutFinalHtlcOutcome: s.chanStateDB.PutOnchainFinalHtlcOutcome, // nolint: lll
PutFinalHtlcOutcome: s.chanStateDB.PutOnchainFinalHtlcOutcome, //nolint: lll
HtlcNotifier: s.htlcNotifier,
}, dbs.ChanStateDB)

Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/btcsuite/btcd v0.23.3
github.com/golangci/golangci-lint v1.46.2
github.com/golangci/golangci-lint v1.50.1
github.com/ory/go-acc v0.2.6
github.com/rinchsan/gosimports v0.1.5
)
Loading

0 comments on commit 87ca48f

Please sign in to comment.