Skip to content

Commit e98f733

Browse files
committed
linter: fix lint issues after linter v2 update
1 parent bd6271e commit e98f733

29 files changed

+65
-59
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ var (
9393
// Client performs the client side part of swaps. This interface exists to be
9494
// able to implement a stub.
9595
type Client struct {
96+
clientConfig
97+
9698
started uint32 // To be used atomically.
9799
errChan chan error
98100

@@ -107,8 +109,6 @@ type Client struct {
107109

108110
resumeReady chan struct{}
109111
wg sync.WaitGroup
110-
111-
clientConfig
112112
}
113113

114114
// ClientConfig is the exported configuration structure that is required to

cmd/loop/instantout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ func instantOut(ctx *cli.Context) error {
187187
DestAddr: ctx.String("addr"),
188188
},
189189
)
190-
191190
if err != nil {
192191
return err
193192
}
@@ -228,5 +227,6 @@ func listInstantOuts(ctx *cli.Context) error {
228227
}
229228

230229
printRespJSON(resp)
230+
231231
return nil
232232
}

cmd/loop/loopin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ func loopIn(ctx *cli.Context) error {
207207

208208
fmt.Printf("Swap initiated\n")
209209
fmt.Printf("ID: %v\n", resp.Id)
210+
210211
if resp.HtlcAddressP2Tr != "" {
211212
fmt.Printf("HTLC address (P2TR): %v\n", resp.HtlcAddressP2Tr)
212213
} else {

cmd/loop/loopout.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ func loopOut(ctx *cli.Context) error {
176176
"address to sweep the loop amount to")
177177
}
178178

179-
var destAddr string
180-
var account string
179+
var (
180+
destAddr string
181+
account string
182+
)
181183
switch {
182184
case ctx.IsSet("addr"):
183185
destAddr = ctx.String("addr")

cmd/loop/staticaddr.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ func utxosToOutpoints(utxos []string) ([]*looprpc.OutPoint, error) {
417417
if len(utxos) == 0 {
418418
return nil, fmt.Errorf("no utxos specified")
419419
}
420+
420421
for _, utxo := range utxos {
421422
outpoint, err := NewProtoOutPoint(utxo)
422423
if err != nil {

cost_migration.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func CalculateLoopOutCost(params *chaincfg.Params, loopOutSwap *loopdb.LoopOut,
2525
paymentFees map[lntypes.Hash]lnwire.MilliSatoshi) (loopdb.SwapCost,
2626
error) {
2727

28-
// First make sure that this swap is actually finished.
28+
// First, make sure that this swap is actually finished.
2929
if loopOutSwap.State().State.IsPending() {
3030
return loopdb.SwapCost{}, fmt.Errorf("swap is not yet finished")
3131
}
@@ -41,8 +41,8 @@ func CalculateLoopOutCost(params *chaincfg.Params, loopOutSwap *loopdb.LoopOut,
4141
}
4242

4343
// The swap hash is given and we don't need to get it from the
44-
// swap invoice, however we'll decode it anyway to get the invoice amount
45-
// that was paid in case we don't have the payment anymore.
44+
// swap invoice, however we'll decode it anyway to get the invoice
45+
// amount that was paid in case we don't have the payment anymore.
4646
_, _, swapHash, swapPaymentAmount, err := swap.DecodeInvoice(
4747
params, loopOutSwap.Contract.SwapInvoice,
4848
)
@@ -195,6 +195,6 @@ func MigrateLoopOutCosts(ctx context.Context, lnd lndclient.LndServices,
195195
return err
196196
}
197197

198-
// Finally mark the migration as done.
198+
// Finally, mark the migration as done.
199199
return db.SetMigration(ctx, costMigrationID)
200200
}

executor.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,14 @@ type executorConfig struct {
4242
}
4343

4444
// executor is responsible for executing swaps.
45-
//
46-
// TODO(roasbeef): rename to SubSwapper.
4745
type executor struct {
46+
sync.Mutex
47+
executorConfig
48+
4849
wg sync.WaitGroup
4950
newSwaps chan genericSwap
5051
currentHeight uint32
5152
ready chan struct{}
52-
53-
sync.Mutex
54-
55-
executorConfig
5653
}
5754

5855
// newExecutor returns a new swap executor instance.
@@ -80,7 +77,6 @@ func (s *executor) run(mainCtx context.Context,
8077
for {
8178
blockEpochChan, blockErrorChan, err =
8279
s.lnd.ChainNotifier.RegisterBlockEpochNtfn(mainCtx)
83-
8480
if err == nil {
8581
break
8682
}

fsm/fsm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func NewStateMachine(states States, observerSize int) *StateMachine {
138138
func NewStateMachineWithState(states States, current StateType,
139139
observerSize int) *StateMachine {
140140

141-
observers := []Observer{}
141+
var observers []Observer
142142
var defaultObserver *CachedObserver
143143

144144
if observerSize > 0 {

fsm/observer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ func (c *CachedObserver) WaitForStateAsync(ctx context.Context, state StateType,
194194

195195
// FixedSizeSlice is a slice with a fixed size.
196196
type FixedSizeSlice[T any] struct {
197+
sync.Mutex
198+
197199
data []T
198200
maxLen int
199-
200-
sync.Mutex
201201
}
202202

203203
// NewFixedSizeSlice initializes a new FixedSlice with a given maximum length.

instantout/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var (
2222

2323
// Manager manages the instantout state machines.
2424
type Manager struct {
25+
sync.Mutex
26+
2527
// cfg contains all the services that the reservation manager needs to
2628
// operate.
2729
cfg *Config
@@ -36,8 +38,6 @@ type Manager struct {
3638
blockEpochChan chan int32
3739

3840
runCtx context.Context
39-
40-
sync.Mutex
4141
}
4242

4343
// NewInstantOutManager creates a new instantout manager.

0 commit comments

Comments
 (0)