Skip to content

Commit 1bdaff8

Browse files
authored
Merge pull request #1058 from hieblmi/minor-fixes
multi: fix `staticcheck` flags
2 parents 3441575 + d1c4a7d commit 1bdaff8

32 files changed

+1291
-4367
lines changed

assets/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func getClientConn(config *TapdConfig) (*grpc.ClientConn, error) {
306306
}
307307

308308
// Dial the gRPC server.
309-
conn, err := grpc.Dial(config.Host, opts...)
309+
conn, err := grpc.NewClient(config.Host, opts...)
310310
if err != nil {
311311
return nil, err
312312
}

cmd/loop/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func getDebugClient(ctx context.Context, cmd *cli.Command) (looprpc.DebugClient,
4848
if err != nil {
4949
return nil, nil, err
5050
}
51-
conn, err := getClientConn(ctx, rpcServer, tlsCertPath, macaroonPath)
51+
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
5252
if err != nil {
5353
return nil, nil, err
5454
}

cmd/loop/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var getInfoCommand = &cli.Command{
1717
}
1818

1919
func getInfo(ctx context.Context, cmd *cli.Command) error {
20-
client, cleanup, err := getClient(ctx, cmd)
20+
client, cleanup, err := getClient(cmd)
2121
if err != nil {
2222
return err
2323
}

cmd/loop/instantout.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func instantOut(ctx context.Context, cmd *cli.Command) error {
5353
}
5454

5555
// First set up the swap client itself.
56-
client, cleanup, err := getClient(ctx, cmd)
56+
client, cleanup, err := getClient(cmd)
5757
if err != nil {
5858
return err
5959
}
@@ -213,7 +213,7 @@ var listInstantOutsCommand = &cli.Command{
213213

214214
func listInstantOuts(ctx context.Context, cmd *cli.Command) error {
215215
// First set up the swap client itself.
216-
client, cleanup, err := getClient(ctx, cmd)
216+
client, cleanup, err := getClient(cmd)
217217
if err != nil {
218218
return err
219219
}

cmd/loop/l402.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var listAuthCommand = &cli.Command{
3232
}
3333

3434
func listAuth(ctx context.Context, cmd *cli.Command) error {
35-
client, cleanup, err := getClient(ctx, cmd)
35+
client, cleanup, err := getClient(cmd)
3636
if err != nil {
3737
return err
3838
}
@@ -85,7 +85,7 @@ var fetchL402Command = &cli.Command{
8585
}
8686

8787
func fetchL402(ctx context.Context, cmd *cli.Command) error {
88-
client, cleanup, err := getClient(ctx, cmd)
88+
client, cleanup, err := getClient(cmd)
8989
if err != nil {
9090
return err
9191
}

cmd/loop/liquidity.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var getLiquidityParamsCommand = &cli.Command{
2525
}
2626

2727
func getParams(ctx context.Context, cmd *cli.Command) error {
28-
client, cleanup, err := getClient(ctx, cmd)
28+
client, cleanup, err := getClient(cmd)
2929
if err != nil {
3030
return err
3131
}
@@ -98,15 +98,15 @@ func setRule(ctx context.Context, cmd *cli.Command) error {
9898
pubkeyRule = true
9999
}
100100

101-
client, cleanup, err := getClient(ctx, cmd)
101+
client, cleanup, err := getClient(cmd)
102102
if err != nil {
103103
return err
104104
}
105105
defer cleanup()
106106

107107
// We need to set the full set of current parameters every time we call
108108
// SetParameters. To allow users to set only individual fields on the
109-
// cli, we lookup our current params, then update individual values.
109+
// cli, we look up our current params, then update individual values.
110110
params, err := client.GetLiquidityParams(
111111
ctx, &looprpc.GetLiquidityParamsRequest{},
112112
)
@@ -395,15 +395,15 @@ var setParamsCommand = &cli.Command{
395395
}
396396

397397
func setParams(ctx context.Context, cmd *cli.Command) error {
398-
client, cleanup, err := getClient(ctx, cmd)
398+
client, cleanup, err := getClient(cmd)
399399
if err != nil {
400400
return err
401401
}
402402
defer cleanup()
403403

404404
// We need to set the full set of current parameters every time we call
405405
// SetParameters. To allow users to set only individual fields on the
406-
// cli, we lookup our current params, then update individual values.
406+
// cli, we look up our current params, then update individual values.
407407
params, err := client.GetLiquidityParams(
408408
ctx, &looprpc.GetLiquidityParamsRequest{},
409409
)
@@ -693,7 +693,7 @@ var suggestSwapCommand = &cli.Command{
693693
}
694694

695695
func suggestSwap(ctx context.Context, cmd *cli.Command) error {
696-
client, cleanup, err := getClient(ctx, cmd)
696+
client, cleanup, err := getClient(cmd)
697697
if err != nil {
698698
return err
699699
}

cmd/loop/loopin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func loopIn(ctx context.Context, cmd *cli.Command) error {
108108
return err
109109
}
110110

111-
client, cleanup, err := getClient(ctx, cmd)
111+
client, cleanup, err := getClient(cmd)
112112
if err != nil {
113113
return err
114114
}

cmd/loop/loopout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func loopOut(ctx context.Context, cmd *cli.Command) error {
237237
}
238238
}
239239

240-
client, cleanup, err := getClient(ctx, cmd)
240+
client, cleanup, err := getClient(cmd)
241241
if err != nil {
242242
return err
243243
}

cmd/loop/main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ func main() {
192192

193193
// getClient establishes a SwapClient RPC connection and returns the client and
194194
// a cleanup handler.
195-
func getClient(ctx context.Context, cmd *cli.Command) (looprpc.SwapClientClient,
195+
func getClient(cmd *cli.Command) (looprpc.SwapClientClient,
196196
func(), error) {
197197

198-
client, _, cleanup, err := getClientWithConn(ctx, cmd)
198+
client, _, cleanup, err := getClientWithConn(cmd)
199199
if err != nil {
200200
return nil, nil, err
201201
}
@@ -205,15 +205,15 @@ func getClient(ctx context.Context, cmd *cli.Command) (looprpc.SwapClientClient,
205205

206206
// getClientWithConn returns both the SwapClient RPC client and the underlying
207207
// gRPC connection so callers can perform connection-aware actions.
208-
func getClientWithConn(ctx context.Context, cmd *cli.Command) (
209-
looprpc.SwapClientClient, *grpc.ClientConn, func(), error) {
208+
func getClientWithConn(cmd *cli.Command) (looprpc.SwapClientClient,
209+
*grpc.ClientConn, func(), error) {
210210

211211
rpcServer := cmd.String("rpcserver")
212212
tlsCertPath, macaroonPath, err := extractPathArgs(cmd)
213213
if err != nil {
214214
return nil, nil, nil, err
215215
}
216-
conn, err := getClientConn(ctx, rpcServer, tlsCertPath, macaroonPath)
216+
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
217217
if err != nil {
218218
return nil, nil, nil, err
219219
}
@@ -432,7 +432,7 @@ func logSwap(swap *looprpc.SwapStatus) {
432432
fmt.Println()
433433
}
434434

435-
func getClientConn(ctx context.Context, address, tlsCertPath, macaroonPath string) (*grpc.ClientConn,
435+
func getClientConn(address, tlsCertPath, macaroonPath string) (*grpc.ClientConn,
436436
error) {
437437

438438
// We always need to send a macaroon.
@@ -446,17 +446,17 @@ func getClientConn(ctx context.Context, address, tlsCertPath, macaroonPath strin
446446
macOption,
447447
}
448448

449-
// TLS cannot be disabled, we'll always have a cert file to read.
449+
// Since TLS cannot be disabled, we'll always have a cert file to read.
450450
creds, err := credentials.NewClientTLSFromFile(tlsCertPath, "")
451451
if err != nil {
452452
return nil, err
453453
}
454454

455455
opts = append(opts, grpc.WithTransportCredentials(creds))
456456

457-
conn, err := grpc.DialContext(ctx, address, opts...)
457+
conn, err := grpc.NewClient(address, opts...)
458458
if err != nil {
459-
return nil, fmt.Errorf("unable to connect to RPC server: %v",
459+
return nil, fmt.Errorf("unable to create RPC client: %v",
460460
err)
461461
}
462462

cmd/loop/monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var monitorCommand = &cli.Command{
1616
}
1717

1818
func monitor(ctx context.Context, cmd *cli.Command) error {
19-
client, cleanup, err := getClient(ctx, cmd)
19+
client, cleanup, err := getClient(cmd)
2020
if err != nil {
2121
return err
2222
}

0 commit comments

Comments
 (0)