Skip to content

Commit bb53bb3

Browse files
Laure-diremyleone
andauthored
fix(golangci-lint): update code to fix ci (#3653)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 7f39070 commit bb53bb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+151
-151
lines changed

internal/args/unmarshal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func TestUnmarshalStruct(t *testing.T) {
338338
data: &map[string]string{},
339339
}))
340340

341-
t.Run("IP", func(t *testing.T) {
341+
t.Run("IP", func(_ *testing.T) {
342342
ip := net.IPv4(1, 2, 3, 4)
343343
run(TestCase{
344344
args: []string{

internal/core/arg_specs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func ZoneArgSpec(zones ...scw.Zone) *ArgSpec {
131131
Name: "zone",
132132
Short: "Zone to target. If none is passed will use default zone from the config",
133133
EnumValues: enumValues,
134-
ValidateFunc: func(argSpec *ArgSpec, value interface{}) error {
134+
ValidateFunc: func(_ *ArgSpec, value interface{}) error {
135135
for _, zone := range zones {
136136
if value.(scw.Zone) == zone {
137137
return nil
@@ -162,7 +162,7 @@ func RegionArgSpec(regions ...scw.Region) *ArgSpec {
162162
Name: "region",
163163
Short: "Region to target. If none is passed will use default region from the config",
164164
EnumValues: enumValues,
165-
ValidateFunc: func(argSpec *ArgSpec, value interface{}) error {
165+
ValidateFunc: func(_ *ArgSpec, value interface{}) error {
166166
for _, region := range regions {
167167
if value.(scw.Region) == region {
168168
return nil

internal/core/autocomplete_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func testAutocompleteGetCommands() *Commands {
2929
},
3030
{
3131
Name: "size",
32-
AutoCompleteFunc: func(ctx context.Context, prefix string) AutocompleteSuggestions {
32+
AutoCompleteFunc: func(_ context.Context, prefix string) AutocompleteSuggestions {
3333
return []string{regexp.MustCompile("[a-z]").ReplaceAllString(prefix, "")}
3434
},
3535
EnumValues: []string{"S", "M", "L", "XL", "XXL"},
@@ -43,7 +43,7 @@ func testAutocompleteGetCommands() *Commands {
4343
EnumValues: []string{"S", "M", "L", "XL", "XXL"},
4444
},
4545
},
46-
WaitFunc: func(ctx context.Context, argsI, respI interface{}) (interface{}, error) {
46+
WaitFunc: func(_ context.Context, _, _ interface{}) (interface{}, error) {
4747
return nil, nil
4848
},
4949
},
@@ -211,7 +211,7 @@ func TestAutocompleteArgs(t *testing.T) {
211211
ArgsType: reflect.TypeOf(struct {
212212
}{}),
213213
ArgSpecs: ArgSpecs{},
214-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
214+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
215215
return []*struct {
216216
Name string
217217
}{
@@ -231,7 +231,7 @@ func TestAutocompleteArgs(t *testing.T) {
231231
ArgsType: reflect.TypeOf(struct {
232232
}{}),
233233
ArgSpecs: ArgSpecs{},
234-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
234+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
235235
return []*struct {
236236
Name string
237237
}{

internal/core/bootstrap_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestInterruptError(t *testing.T) {
1818
Resource: "interrupt",
1919
Verb: "error",
2020
ArgsType: reflect.TypeOf(args.RawArgs{}),
21-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
21+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
2222
return nil, &interactive.InterruptError{}
2323
},
2424
},
@@ -35,7 +35,7 @@ func TestInterruptError(t *testing.T) {
3535
Resource: "code",
3636
Verb: "error",
3737
ArgsType: reflect.TypeOf(args.RawArgs{}),
38-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
38+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
3939
return nil, &CliError{Code: 99}
4040
},
4141
},
@@ -52,7 +52,7 @@ func TestInterruptError(t *testing.T) {
5252
Resource: "empty",
5353
Verb: "error",
5454
ArgsType: reflect.TypeOf(args.RawArgs{}),
55-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
55+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
5656
return nil, &CliError{Code: 99, Empty: true}
5757
},
5858
},
@@ -72,7 +72,7 @@ func TestInterruptError(t *testing.T) {
7272
Resource: "empty",
7373
Verb: "error",
7474
ArgsType: reflect.TypeOf(args.RawArgs{}),
75-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
75+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
7676
return nil, &CliError{Code: 99, Empty: true}
7777
},
7878
},
@@ -92,7 +92,7 @@ func TestInterruptError(t *testing.T) {
9292
Resource: "empty",
9393
Verb: "success",
9494
ArgsType: reflect.TypeOf(args.RawArgs{}),
95-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
95+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
9696
return &SuccessResult{
9797
Empty: true,
9898
Message: "dummy",
@@ -115,7 +115,7 @@ func TestInterruptError(t *testing.T) {
115115
Resource: "empty",
116116
Verb: "success",
117117
ArgsType: reflect.TypeOf(args.RawArgs{}),
118-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
118+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
119119
return &SuccessResult{
120120
Empty: true,
121121
Message: "dummy",
@@ -138,7 +138,7 @@ func TestInterruptError(t *testing.T) {
138138
Resource: "empty",
139139
Verb: "success",
140140
ArgsType: reflect.TypeOf(args.RawArgs{}),
141-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
141+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
142142
return []int(nil), nil
143143
},
144144
AllowAnonymousClient: true,

internal/core/build_info_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var fakeCommand = &Command{
1818
Namespace: "plop",
1919
ArgsType: reflect.TypeOf(args.RawArgs{}),
2020
AllowAnonymousClient: true,
21-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
21+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
2222
return &SuccessResult{}, nil
2323
},
2424
}

internal/core/checks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestCheckAPIKey(t *testing.T) {
2020
Namespace: "test",
2121
ArgSpecs: ArgSpecs{},
2222
ArgsType: reflect.TypeOf(testType{}),
23-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
23+
Run: func(ctx context.Context, _ interface{}) (i interface{}, e error) {
2424
// Test command reload the client so the profile used is the edited one
2525
return "", ReloadClient(ctx)
2626
},

internal/core/cobra_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Relative time error: %s
240240
}
241241

242242
func cobraRunHelp(cmd *Command) func(cmd *cobra.Command, args []string) error {
243-
return func(cobraCmd *cobra.Command, args []string) error {
243+
return func(cobraCmd *cobra.Command, _ []string) error {
244244
webFlag, err := cobraCmd.PersistentFlags().GetBool("web")
245245
if err == nil && webFlag {
246246
out, err := runWeb(cmd, nil)

internal/core/cobra_utils_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func testGetCommands() *Commands {
3030
},
3131
AllowAnonymousClient: true,
3232
ArgsType: reflect.TypeOf(testType{}),
33-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
33+
Run: func(_ context.Context, _ interface{}) (i interface{}, e error) {
3434
return "", nil
3535
},
3636
},
@@ -48,7 +48,7 @@ func testGetCommands() *Commands {
4848
},
4949
AllowAnonymousClient: true,
5050
ArgsType: reflect.TypeOf(testType{}),
51-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
51+
Run: func(_ context.Context, argsI interface{}) (i interface{}, e error) {
5252
return argsI, nil
5353
},
5454
},
@@ -57,7 +57,7 @@ func testGetCommands() *Commands {
5757
Resource: "raw-args",
5858
ArgsType: reflect.TypeOf(args.RawArgs{}),
5959
AllowAnonymousClient: true,
60-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
60+
Run: func(_ context.Context, argsI interface{}) (i interface{}, e error) {
6161
res := ""
6262
rawArgs := *argsI.(*args.RawArgs)
6363
for i, arg := range rawArgs {
@@ -74,7 +74,7 @@ func testGetCommands() *Commands {
7474
Resource: "date",
7575
ArgsType: reflect.TypeOf(testDate{}),
7676
AllowAnonymousClient: true,
77-
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
77+
Run: func(_ context.Context, argsI interface{}) (i interface{}, e error) {
7878
a := argsI.(*testDate)
7979
return a.Date, nil
8080
},

internal/core/command_interceptor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func combineCommandInterceptor(interceptors ...CommandInterceptor) CommandInterc
2626

2727
previousInterceptor := combinedInterceptors
2828
combinedInterceptors = func(ctx context.Context, args interface{}, runner CommandRunner) (interface{}, error) {
29-
return previousInterceptor(ctx, args, func(ctx context.Context, arg interface{}) (interface{}, error) {
29+
return previousInterceptor(ctx, args, func(ctx context.Context, _ interface{}) (interface{}, error) {
3030
return localInterceptor(ctx, args, runner)
3131
})
3232
}

internal/core/printer_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func Test_CorePrinter(t *testing.T) {
1616
&Command{
1717
Namespace: "get",
1818
ArgsType: reflect.TypeOf(struct{}{}),
19-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
19+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
2020
return Human{
2121
ID: "111111111-111111111",
2222
Name: "David Copperfield",
@@ -26,7 +26,7 @@ func Test_CorePrinter(t *testing.T) {
2626
&Command{
2727
Namespace: "list",
2828
ArgsType: reflect.TypeOf(struct{}{}),
29-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
29+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
3030
return []*Human{
3131
{ID: "111111111-111111111", Name: "David Copperfield"},
3232
{ID: "222222222-222222222", Name: "Xavier Niel"},
@@ -76,7 +76,7 @@ func Test_YamlPrinter(t *testing.T) {
7676
&Command{
7777
Namespace: "get",
7878
ArgsType: reflect.TypeOf(struct{}{}),
79-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
79+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
8080
return Human{
8181
ID: "111111111-111111111",
8282
Name: "David Copperfield",
@@ -86,7 +86,7 @@ func Test_YamlPrinter(t *testing.T) {
8686
&Command{
8787
Namespace: "list",
8888
ArgsType: reflect.TypeOf(struct{}{}),
89-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
89+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
9090
return []*Human{
9191
{ID: "111111111-111111111", Name: "David Copperfield"},
9292
{ID: "222222222-222222222", Name: "Xavier Niel"},
@@ -96,7 +96,7 @@ func Test_YamlPrinter(t *testing.T) {
9696
&Command{
9797
Namespace: "NilSlice",
9898
ArgsType: reflect.TypeOf(struct{}{}),
99-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
99+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
100100
return []Human{}, nil
101101
},
102102
},
@@ -149,7 +149,7 @@ func Test_TemplatePrinter(t *testing.T) {
149149
&Command{
150150
Namespace: "get",
151151
ArgsType: reflect.TypeOf(struct{}{}),
152-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
152+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
153153
return Human{
154154
ID: "111111111-111111111",
155155
Name: "David Copperfield",
@@ -159,7 +159,7 @@ func Test_TemplatePrinter(t *testing.T) {
159159
&Command{
160160
Namespace: "list",
161161
ArgsType: reflect.TypeOf(struct{}{}),
162-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
162+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
163163
return []*Human{
164164
{ID: "111111111-111111111", Name: "David Copperfield"},
165165
{ID: "222222222-222222222", Name: "Xavier Niel"},
@@ -169,7 +169,7 @@ func Test_TemplatePrinter(t *testing.T) {
169169
&Command{
170170
Namespace: "NilSlice",
171171
ArgsType: reflect.TypeOf(struct{}{}),
172-
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
172+
Run: func(_ context.Context, _ interface{}) (interface{}, error) {
173173
return []Human{}, nil
174174
},
175175
},

0 commit comments

Comments
 (0)