Skip to content

Commit 24952da

Browse files
committed
fixed linter warnings
1 parent 3be1230 commit 24952da

40 files changed

Lines changed: 171 additions & 173 deletions

.golangci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
run:
44
deadline: 5m
5-
skip-dirs:
6-
thirdparty/
75

86
linters:
97
# please, do not use `enable-all`: it's deprecated and will be removed soon.
108
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
119
disable-all: true
1210
enable:
1311
- bodyclose
14-
- deadcode
15-
- depguard
1612
- dogsled
1713
- dupl
1814
- errcheck
@@ -33,19 +29,19 @@ linters:
3329
- misspell
3430
- nakedret
3531
- staticcheck
36-
- structcheck
3732
- stylecheck
3833
- revive
3934
- typecheck
4035
- unconvert
4136
- unparam
4237
- unused
43-
- varcheck
4438
- whitespace
4539

4640
issues:
4741
exclude:
4842
- Using the variable on range scope `tc` in function literal
43+
exclude-dirs:
44+
- thirdparty/
4945

5046
linters-settings:
5147
dupl:

commands/alpha/alphacmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func GetCommand(ctx context.Context, _, version string) *cobra.Command {
3232
Use: "alpha",
3333
Short: alphadocs.AlphaShort,
3434
Long: alphadocs.AlphaLong,
35-
RunE: func(cmd *cobra.Command, args []string) error {
35+
RunE: func(cmd *cobra.Command, _ []string) error {
3636
h, err := cmd.Flags().GetBool("help")
3737
if err != nil {
3838
return err

commands/alpha/license/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func NewCommand(ctx context.Context, _ string) *cobra.Command {
2727
Use: "license",
2828
Short: "[Alpha] " + licensedocs.LicenseShort,
2929
Long: "[Alpha] " + licensedocs.LicenseShort + "\n" + licensedocs.LicenseLong,
30-
RunE: func(cmd *cobra.Command, args []string) error {
30+
RunE: func(cmd *cobra.Command, _ []string) error {
3131
h, err := cmd.Flags().GetBool("help")
3232
if err != nil {
3333
return err

commands/alpha/rollouts/rolloutscmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewCommand(ctx context.Context, version string) *cobra.Command {
2929
Use: "rollouts",
3030
Short: "rollouts",
3131
Long: "rollouts",
32-
RunE: func(cmd *cobra.Command, args []string) error {
32+
RunE: func(cmd *cobra.Command, _ []string) error {
3333
h, err := cmd.Flags().GetBool("help")
3434
if err != nil {
3535
return err

commands/fn/doc/cmdfndoc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewRunner(ctx context.Context, parent string) *Runner {
4343
}
4444
r.Command = c
4545
c.Flags().StringVarP(&r.Image, "image", "i", "", "kpt function image name")
46-
_ = r.Command.RegisterFlagCompletionFunc("image", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
46+
_ = r.Command.RegisterFlagCompletionFunc("image", func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
4747
return cmdutil.SuggestFunctions(cmd), cobra.ShellCompDirectiveDefault
4848
})
4949
cmdutil.FixDocs("kpt", parent, c)

commands/fn/fncmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func GetCommand(ctx context.Context, name string) *cobra.Command {
3232
Short: fndocs.FnShort,
3333
Long: fndocs.FnLong,
3434
Aliases: []string{"functions"},
35-
RunE: func(cmd *cobra.Command, args []string) error {
35+
RunE: func(cmd *cobra.Command, _ []string) error {
3636
h, err := cmd.Flags().GetBool("help")
3737
if err != nil {
3838
return err

commands/fn/render/cmdrender.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func NewRunner(ctx context.Context, parent string) *Runner {
5353

5454
c.Flags().Var(&r.RunnerOptions.ImagePullPolicy, "image-pull-policy",
5555
"pull image before running the container "+r.RunnerOptions.ImagePullPolicy.HelpAllowedValues())
56-
_ = c.RegisterFlagCompletionFunc("image-pull-policy", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
56+
_ = c.RegisterFlagCompletionFunc("image-pull-policy", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
5757
return r.RunnerOptions.ImagePullPolicy.AllStrings(), cobra.ShellCompDirectiveDefault
5858
})
5959

commands/fn/render/cmdrender_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ func TestCmd_flagAndArgParsing_Symlink(t *testing.T) {
4444
}
4545

4646
// NoOpRunE is a noop function to replace the run function of a command. Useful for testing argument parsing.
47-
var NoOpRunE = func(cmd *cobra.Command, args []string) error { return nil }
47+
var NoOpRunE = func(_ *cobra.Command, _ []string) error { return nil }

commands/live/migrate/migratecmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func NewRunner(
8686
Short: livedocs.MigrateShort,
8787
Long: livedocs.MigrateShort + "\n" + livedocs.MigrateLong,
8888
Example: livedocs.MigrateExamples,
89-
RunE: func(cmd *cobra.Command, args []string) error {
89+
RunE: func(_ *cobra.Command, args []string) error {
9090
if len(args) == 0 {
9191
// default to current working directory
9292
args = append(args, ".")

commands/live/migrate/migratecmd_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func TestKptMigrate_migrateKptfileToRG(t *testing.T) {
168168
migrateRunner := NewRunner(ctx, tf, cmLoader, ioStreams)
169169
migrateRunner.dryRun = tc.dryRun
170170
migrateRunner.rgFile = tc.rgFilename
171-
migrateRunner.cmInvClientFunc = func(factory util.Factory) (inventory.Client, error) {
171+
migrateRunner.cmInvClientFunc = func(_ util.Factory) (inventory.Client, error) {
172172
return inventory.NewFakeClient([]object.ObjMetadata{}), nil
173173
}
174174
err = migrateRunner.migrateKptfileToRG([]string{dir})
@@ -242,7 +242,7 @@ func TestKptMigrate_retrieveConfigMapInv(t *testing.T) {
242242
// Create MigrateRunner and call "retrieveConfigMapInv"
243243
cmLoader := manifestreader.NewManifestLoader(tf)
244244
migrateRunner := NewRunner(ctx, tf, cmLoader, ioStreams)
245-
migrateRunner.cmInvClientFunc = func(factory util.Factory) (inventory.Client, error) {
245+
migrateRunner.cmInvClientFunc = func(_ util.Factory) (inventory.Client, error) {
246246
return inventory.NewFakeClient([]object.ObjMetadata{}), nil
247247
}
248248
actual, err := migrateRunner.retrieveConfigMapInv(strings.NewReader(tc.configMap), []string{"-"})

0 commit comments

Comments
 (0)