Skip to content

Commit c051a07

Browse files
committed
Lint
Signed-off-by: Matthias Geihs <[email protected]>
1 parent e62c1b4 commit c051a07

File tree

9 files changed

+18
-10
lines changed

9 files changed

+18
-10
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ linters:
2424
- wsl # Formatting disabled for now.
2525
- gochecknoinits # We use init functions.
2626
- gci # We have our own import order.
27+
- goerr113 # We do not strictly require static errors.
28+
- promlinter # Disabled because unstable.
2729

2830
# These could be enabled in the future:
2931
- ifshort # we often don't use `if err := …` for readability.

channel/persistence/test/channel.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func NewRandomChannel(
5454
user channel.Index,
5555
peers []wire.Address,
5656
parent *Channel,
57-
rng *rand.Rand) (c *Channel) {
57+
rng *rand.Rand,
58+
) (c *Channel) {
5859
accs, parts := wtest.NewRandomAccounts(rng, len(peers))
5960
params := ctest.NewRandomParams(rng, ctest.WithParts(parts...))
6061
csm, err := channel.NewStateMachine(accs[0], *params)

channel/persistence/test/persistrestorer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func NewPersistRestorer(t *testing.T) *PersistRestorer {
5757

5858
// ChannelCreated fully persists all of the source's data.
5959
func (pr *PersistRestorer) ChannelCreated(
60-
_ context.Context, source channel.Source, peers []wire.Address, parent *channel.ID) error {
60+
_ context.Context, source channel.Source, peers []wire.Address, parent *channel.ID,
61+
) error {
6162
pr.mu.Lock()
6263
defer pr.mu.Unlock()
6364

channel/persistence/test/persistrestorertest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ func GenericPersistRestorerTest(
8282
rng *rand.Rand,
8383
pr persistence.PersistRestorer,
8484
numPeers int,
85-
numChans int) {
85+
numChans int,
86+
) {
8687
t.Helper()
8788
t.Run("RestoreChannel error", func(t *testing.T) {
8889
var id channel.ID

client/restore.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ func (c *Client) restorePeerChannels(ctx context.Context, p wire.Address) (err e
9696

9797
func (c *Client) restoreChannelCollection(
9898
db map[channel.ID]*persistence.Channel,
99-
channelFromSource channelFromSourceSig) {
99+
channelFromSource channelFromSourceSig,
100+
) {
100101
chs := make(map[channel.ID]*Channel)
101102
for _, pch := range db {
102103
ch := c.reconstructChannel(channelFromSource, pch, db, chs)

client/restore_internal_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ func mkRndChan(rng *rand.Rand) *persistence.Channel {
130130
func mkRndChanTree(
131131
rng *rand.Rand,
132132
depth, minChildren, maxChildren int,
133-
db map[channel.ID]*persistence.Channel) (root *persistence.Channel) {
133+
db map[channel.ID]*persistence.Channel,
134+
) (root *persistence.Channel) {
134135
root = mkRndChan(rng)
135136
db[root.ID()] = root
136137

client/update.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ func (c *Channel) enableNotifyUpdate(ctx context.Context) error {
382382
} else {
383383
err = c.machine.EnableUpdate(ctx)
384384
}
385-
386385
if err != nil {
387386
return errors.WithMessage(err, "enabling update")
388387
}
@@ -391,8 +390,8 @@ func (c *Channel) enableNotifyUpdate(ctx context.Context) error {
391390
c.onUpdate(from, to)
392391
}
393392

394-
if err = c.statesPub.Publish(ctx, c.machine.CurrentTX()); err != nil {
395-
c.Log().WithField("Version", c.state().Version).Errorf("Error publishe state to watcher: %v", err)
393+
if err := c.statesPub.Publish(ctx, c.machine.CurrentTX()); err != nil {
394+
c.Log().WithField("Version", c.state().Version).Errorf("publishing state to watcher: %w", err)
396395
}
397396
return nil
398397
}

wire/net/endpoint_registry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ func (r *EndpointRegistry) authenticatedDial(
220220
ctx context.Context,
221221
addr wire.Address,
222222
de *dialingEndpoint,
223-
created bool) (ret *Endpoint, _ error) {
223+
created bool,
224+
) (ret *Endpoint, _ error) {
224225
key := wallet.Key(addr)
225226

226227
// Short cut: another dial for that peer is already in progress.

wire/test/bustest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const testNoReceiveTimeout = 10 * time.Millisecond
4040
// the client to, and a bus the client should use for publishing messages.
4141
func GenericBusTest(t *testing.T,
4242
busAssigner func(wire.Account) (pub wire.Bus, sub wire.Bus),
43-
numClients, numMsgs int) {
43+
numClients, numMsgs int,
44+
) {
4445
t.Helper()
4546
require.Greater(t, numClients, 1)
4647
require.Greater(t, numMsgs, 0)

0 commit comments

Comments
 (0)