Skip to content

Commit 4865e55

Browse files
authored
lint: unused parameters (#4049)
* lint: unused parameters * lint print, spacing
1 parent 9f63c1c commit 4865e55

File tree

14 files changed

+32
-42
lines changed

14 files changed

+32
-42
lines changed

cmd/crowdsec-cli/clidecision/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ Raw values, standard input:
292292
293293
$ echo "1.2.3.4" | cscli decisions import -i - --format values
294294
`,
295-
RunE: func(cmd *cobra.Command, args []string) error {
295+
RunE: func(cmd *cobra.Command, _ []string) error {
296296
return cli.import_(cmd.Context(), input, duration, scope, reason, decisionType, batch, format)
297297
},
298298
}

cmd/crowdsec-cli/cliexplain/explain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type cliExplain struct {
6161
}
6262
}
6363

64-
func New(cfg configGetter, configFilePath string) *cliExplain {
64+
func New(_ configGetter, configFilePath string) *cliExplain {
6565
return &cliExplain{
6666
configFilePath: configFilePath,
6767
}

cmd/crowdsec-cli/clisetup/acquisition.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"github.com/hexops/gotextdiff/span"
1414
"github.com/spf13/cobra"
1515

16-
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
1716
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/clisetup/setup"
17+
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
1818
)
1919

2020
type acquisitionFlags struct {
@@ -54,7 +54,7 @@ cscli setup install-acquisition setup.yaml --dry-run
5454
`,
5555
Args: args.ExactArgs(1),
5656
DisableAutoGenTag: true,
57-
RunE: func(cmd *cobra.Command, args []string) error {
57+
RunE: func(_ *cobra.Command, args []string) error {
5858
inputReader, err := maybeStdinFile(args[0])
5959
if err != nil {
6060
return err
@@ -100,7 +100,7 @@ func shouldOverwrite(path string, newContent []byte) (bool, error) {
100100
oldContent, err := os.ReadFile(path)
101101
if err != nil {
102102
// File doesn't exist or unreadable, assume overwrite
103-
return true, nil //nolint: nilerr
103+
return true, nil //nolint:nilerr
104104
}
105105

106106
if err := VerifyChecksum(bytes.NewReader(oldContent)); err == nil {

cmd/crowdsec-cli/clisetup/detect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"github.com/sirupsen/logrus"
99
"github.com/spf13/cobra"
1010

11-
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
1211
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/clisetup/setup"
12+
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
1313
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
1414
)
1515

@@ -100,7 +100,7 @@ cscli setup detect --ignore whitelists
100100
`,
101101
Args: args.NoArgs,
102102
DisableAutoGenTag: true,
103-
RunE: func(cmd *cobra.Command, args []string) error {
103+
RunE: func(cmd *cobra.Command, _ []string) error {
104104
ctx := cmd.Context()
105105

106106
detectConfig, rulesFrom, err := f.detectConfig()

cmd/crowdsec-cli/clisetup/setup/exprsystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func NewExprSystem(runningProcesses ProcessMap) *ExprSystem {
1717
}
1818

1919
// ProcessRunning returns true if there is a running process with the given name.
20-
func (e *ExprSystem) ProcessRunning(ctx context.Context, processName string) (bool, error) {
20+
func (e *ExprSystem) ProcessRunning(_ context.Context, processName string) (bool, error) {
2121
_, ok := e.runningProcesses[processName]
2222

2323
return ok, nil

cmd/crowdsec-cli/clisetup/setup/exprsystemd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ func NewExprSystemd(installedUnits UnitMap, logger logrus.FieldLogger) *ExprSyst
2424
}
2525

2626
// UnitInstalled returns true if the unit is installed, even if it is not enabled or running.
27-
func (e *ExprSystemd) UnitInstalled(ctx context.Context, unitName string) (bool, error) {
27+
func (e *ExprSystemd) UnitInstalled(_ context.Context, unitName string) (bool, error) {
2828
_, ok := e.installedUnits[unitName]
2929

3030
return ok, nil
3131
}
3232

3333
// UnitConfig returns the value of the specified key in the unit's configuration.
34-
func (e *ExprSystemd) UnitConfig(ctx context.Context, unitName, key string) (string, error) {
34+
func (e *ExprSystemd) UnitConfig(_ context.Context, unitName, key string) (string, error) {
3535
unit, ok := e.installedUnits[unitName]
3636
if !ok {
3737
// unit not installed

cmd/crowdsec-cli/clisetup/setup/exprwindows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ func NewExprWindows() (*ExprWindows, error) {
1010
return &ExprWindows{}, nil
1111
}
1212

13-
func (*ExprWindows) ServiceEnabled(serviceName string) (bool, error) {
13+
func (*ExprWindows) ServiceEnabled(_ string) (bool, error) {
1414
return false, nil
1515
}

cmd/crowdsec-cli/clisetup/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
"github.com/spf13/cobra"
88

9-
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
109
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/clisetup/setup"
10+
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args"
1111
)
1212

1313
func (cli *cliSetup) newValidateCmd() *cobra.Command {
@@ -25,7 +25,7 @@ generated it through other means.`,
2525

2626
Args: args.ExactArgs(1),
2727
DisableAutoGenTag: true,
28-
RunE: func(cmd *cobra.Command, args []string) error {
28+
RunE: func(_ *cobra.Command, args []string) error {
2929
inputReader, err := maybeStdinFile(args[0])
3030
if err != nil {
3131
return err

cmd/crowdsec-cli/dashboard.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ package main
55
import (
66
"errors"
77
"fmt"
8+
"os"
89

910
"github.com/spf13/cobra"
1011
)
1112

12-
type cliDashboard struct {}
13+
type cliDashboard struct{}
1314

14-
func NewCLIDashboard(cfg configGetter) *cliDashboard {
15+
func NewCLIDashboard(_ configGetter) *cliDashboard {
1516
return &cliDashboard{}
1617
}
1718

@@ -28,8 +29,8 @@ func (*cliDashboard) NewCommand() *cobra.Command {
2829
},
2930
}
3031

31-
cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
32-
fmt.Println(ErrDashboardDeprecated.Error())
32+
cmd.SetHelpFunc(func(_ *cobra.Command, _ []string) {
33+
fmt.Fprintln(os.Stdout, ErrDashboardDeprecated.Error())
3334
})
3435

3536
return cmd

cmd/crowdsec-cli/doc.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"fmt"
5+
"os"
56
"path/filepath"
67
"strings"
78

@@ -28,12 +29,12 @@ func (cli cliDoc) NewCommand(rootCmd *cobra.Command) *cobra.Command {
2829
Args: args.NoArgs,
2930
Hidden: true,
3031
DisableAutoGenTag: true,
31-
RunE: func(_ *cobra.Command, args []string) error {
32+
RunE: func(_ *cobra.Command, _ []string) error {
3233
if err := doc.GenMarkdownTreeCustom(rootCmd, target, cli.filePrepender, cli.linkHandler); err != nil {
3334
return fmt.Errorf("failed to generate cscli documentation: %w", err)
3435
}
3536

36-
fmt.Println("Documentation generated in", target)
37+
fmt.Fprintln(os.Stdout, "Documentation generated in", target)
3738

3839
return nil
3940
},

0 commit comments

Comments
 (0)