Skip to content

Commit

Permalink
golangci-lint: fix linters issues
Browse files Browse the repository at this point in the history
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
  • Loading branch information
mtardy committed Jun 18, 2024
1 parent 6235a08 commit 8bbd3e2
Show file tree
Hide file tree
Showing 22 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion commands/dig.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ arguments.`,

return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
// handles the "all" or "a" and erase the args with the bucket list
// PreRun should guarantee that len(args) != 0 but in case
if len(args) != 0 {
Expand Down
2 changes: 1 addition & 1 deletion commands/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ boolean flags to disabled security features. Examples:
# Fuzz the API server admission
kdigger gen --fuzz-pod --fuzz-init --fuzz-container | kubectl apply --dry-run=server -f -`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
// all puts all the boolean flags to true
if genAll {
opts.HostNetwork = true
Expand Down
2 changes: 1 addition & 1 deletion commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var listCmd = &cobra.Command{
Short: "List available buckets or describe specific ones",
Long: `This command lists the available buckets in the binary. It show their names, aliases
and descriptions. You can pass specific buckets as arguments to have their information.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {

var bucketList []string
if len(args) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var rootCmd = &cobra.Command{
cluster. For that you can use multiples buckets. Buckets are plugins that can
scan specific aspects of a cluster or bring expertise to automate the Kubernetes
pentest process.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if output != outputHuman && output != outputJSON {
return fmt.Errorf("output flag must be one of %s|%s, got %q", outputHuman, outputJSON, output)
}
Expand Down
2 changes: 1 addition & 1 deletion commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var versionCmd = &cobra.Command{
Aliases: []string{"v"},
Short: "Print the version information",
Long: `Print the version tag and git commit hash.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
// leveraging bucket results to print even if it's not a plugin
res := bucket.NewResults("Version")
res.SetHeaders([]string{"tag", "gitCommit", "goVersion", "builderArch"})
Expand Down
10 changes: 5 additions & 5 deletions pkg/kgen/kgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func FuzzPodSecurityContext(sc **v1.PodSecurityContext) {
}
},
// let's ignore Windows for now
func(e *v1.WindowsSecurityContextOptions, c fuzz.Continue) {
func(e *v1.WindowsSecurityContextOptions, _ fuzz.Continue) {
*e = v1.WindowsSecurityContextOptions{}
},
// for supplementalGroups, runAsUser and runAsGroup value that must be between 0 and 2147483647, inclusive
Expand All @@ -103,7 +103,7 @@ func FuzzPodSecurityContext(sc **v1.PodSecurityContext) {
func FuzzContainerSecurityContext(sc **v1.SecurityContext) {
// add .NilChange(0) to disable nil pointers generation, by default is 0.2
f := fuzz.New().NilChance(fuzzNilChances).Funcs(
func(e *v1.WindowsSecurityContextOptions, c fuzz.Continue) {
func(e *v1.WindowsSecurityContextOptions, _ fuzz.Continue) {
*e = v1.WindowsSecurityContextOptions{}
},
func(e *v1.Capability, c fuzz.Continue) {
Expand All @@ -119,9 +119,9 @@ func FuzzContainerSecurityContext(sc **v1.SecurityContext) {
} else {
length := c.Intn(fuzzCapabilityRandomMaxLen)
for i := 0; i < length; i++ {
var cap v1.Capability
c.Fuzz(&cap)
*e = append(*e, cap)
var capa v1.Capability
c.Fuzz(&capa)
*e = append(*e, capa)
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/cgroups/cgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewCgroupsBucket(config bucket.Config) (*Bucket, error) {
func NewCgroupsBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/cloudmetadata/cloudmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewCloudMetadataBucket(config bucket.Config) (*Bucket, error) {
func NewCloudMetadataBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/containerdetect/containerdetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewContainerDetectBucket(config bucket.Config) (*Bucket, error) {
func NewContainerDetectBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/devices/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewDevicesBucket(config bucket.Config) (*Bucket, error) {
func NewDevicesBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewEnvironmentBucket(config bucket.Config) (*Bucket, error) {
func NewEnvironmentBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewMountBucket(config bucket.Config) (*Bucket, error) {
func NewMountBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewNodeBucket(config bucket.Config) (*Bucket, error) {
func NewNodeBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/pidnamespace/pidnamespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewPIDNamespaceBucket(config bucket.Config) (*Bucket, error) {
func NewPIDNamespaceBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/processes/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewProcessesBucket(config bucket.Config) (*Bucket, error) {
func NewProcessesBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewRuntimeBucket(config bucket.Config) (*Bucket, error) {
func NewRuntimeBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewServicesBucket(config bucket.Config) (*Bucket, error) {
func NewServicesBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/syscalls/syscalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewSyscallsBucket(config bucket.Config) (*Bucket, error) {
func NewSyscallsBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewTemplateBucket(config bucket.Config) (*Bucket, error) {
func NewTemplateBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func Register(b *bucket.Buckets) {
})
}

func NewTokenBucket(c bucket.Config) (*Bucket, error) {
func NewTokenBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/userid/userid.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewUserIDBucket(config bucket.Config) (*Bucket, error) {
func NewUserIDBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}
2 changes: 1 addition & 1 deletion pkg/plugins/usernamespace/usernamespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ func Register(b *bucket.Buckets) {
})
}

func NewUserNamespaceBucket(config bucket.Config) (*Bucket, error) {
func NewUserNamespaceBucket(_ bucket.Config) (*Bucket, error) {
return &Bucket{}, nil
}

0 comments on commit 8bbd3e2

Please sign in to comment.