Skip to content

Commit

Permalink
fix: go-lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Aryan-sharma11 <aryan1126.sharma@gmail.com>
  • Loading branch information
Aryan-sharma11 committed May 2, 2023
1 parent 4fe56da commit 72f54ae
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 46 deletions.
6 changes: 2 additions & 4 deletions cmd/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ var discoverCmd = &cobra.Command{
Short: "Discover applicable policies",
Long: `Discover applicable policies`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := discover.Policy(client, discoverOptions); err != nil {
return err
}
return nil
err := discover.Policy(client, discoverOptions)
return err
},
}

Expand Down
6 changes: 2 additions & 4 deletions cmd/recommend.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ var recommendCmd = &cobra.Command{
Short: "Recommend Policies",
Long: `Recommend policies based on container image, k8s manifest or the actual runtime env`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := recommend.Recommend(client, recommendOptions); err != nil {
return err
}
return nil
err := recommend.Recommend(client, recommendOptions)
return err
},
}
var updateCmd = &cobra.Command{
Expand Down
6 changes: 2 additions & 4 deletions cmd/rotate-tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ var rotateCmd = &cobra.Command{
Short: "Rotate webhook controller tls certificates",
Long: `Rotate webhook controller tls certificates`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := rotatetls.RotateTLS(client, namespace); err != nil {
return err
}
return nil
err := rotatetls.RotateTLS(client, namespace)
return err
},
}

Expand Down
6 changes: 2 additions & 4 deletions cmd/selfupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ var selfUpdateCmd = &cobra.Command{
Short: "selfupdate this cli tool",
Long: `selfupdate this cli tool for checking the latest release on the github`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := selfupdate.SelfUpdate(client); err != nil {
return err
}
return nil
err := selfupdate.SelfUpdate()
return err
},
}

Expand Down
6 changes: 2 additions & 4 deletions cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ var uninstallCmd = &cobra.Command{
Long: `Uninstall KubeArmor from a Kubernetes Clusters`,
RunE: func(cmd *cobra.Command, args []string) error {
uninstallOptions.Animation = true
if err := install.K8sUninstaller(client, uninstallOptions); err != nil {
return err
}
return nil
err := install.K8sUninstaller(client, uninstallOptions)
return err
},
}

Expand Down
6 changes: 2 additions & 4 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ var versionCmd = &cobra.Command{
Short: "Display version information",
Long: `Display version information`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := version.PrintVersion(client); err != nil {
return err
}
return nil
err := version.PrintVersion(client)
return err
},
}

Expand Down
18 changes: 6 additions & 12 deletions cmd/vmlabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ var vmLabelAddCmd = &cobra.Command{
// Create http address
httpAddress := "http://" + net.JoinHostPort(HTTPIP, HTTPPort)

if err := vm.LabelHandling("ADD", labelOptions, httpAddress, IsKvmsEnv); err != nil {
return err
}
return nil
err := vm.LabelHandling("ADD", labelOptions, httpAddress, IsKvmsEnv)
return err
},
}

Expand All @@ -46,10 +44,8 @@ var vmLabelDeleteCmd = &cobra.Command{
// Create http address
httpAddress := "http://" + net.JoinHostPort(HTTPIP, HTTPPort)

if err := vm.LabelHandling("DELETE", labelOptions, httpAddress, IsKvmsEnv); err != nil {
return err
}
return nil
err := vm.LabelHandling("DELETE", labelOptions, httpAddress, IsKvmsEnv)
return err
},
}

Expand All @@ -62,10 +58,8 @@ var vmLabelListCmd = &cobra.Command{
// Create http address
httpAddress := "http://" + net.JoinHostPort(HTTPIP, HTTPPort)

if err := vm.LabelHandling("LIST", labelOptions, httpAddress, IsKvmsEnv); err != nil {
return err
}
return nil
err := vm.LabelHandling("LIST", labelOptions, httpAddress, IsKvmsEnv)
return err
},
}

Expand Down
12 changes: 4 additions & 8 deletions cmd/vmonboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ var vmOnboardAddCmd = &cobra.Command{
},
RunE: func(cmd *cobra.Command, args []string) error {
httpAddress := "http://" + net.JoinHostPort(HTTPIP, HTTPPort)
if err := vm.Onboarding("ADDED", args[0], httpAddress); err != nil {
return err
}
return nil
err := vm.Onboarding("ADDED", args[0], httpAddress)
return err
},
}

Expand All @@ -44,10 +42,8 @@ var vmOnboardDeleteCmd = &cobra.Command{
},
RunE: func(cmd *cobra.Command, args []string) error {
httpAddress := "http://" + net.JoinHostPort(HTTPIP, HTTPPort)
if err := vm.Onboarding("DELETED", args[0], httpAddress); err != nil {
return err
}
return nil
err := vm.Onboarding("DELETED", args[0], httpAddress)
return err
},
}

Expand Down
3 changes: 1 addition & 2 deletions selfupdate/selfupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/blang/semver"
"github.com/fatih/color"
"github.com/kubearmor/kubearmor-client/k8s"
"github.com/rhysd/go-github-selfupdate/selfupdate"
)

Expand Down Expand Up @@ -107,7 +106,7 @@ func doSelfUpdate(curver string) error {
}

// SelfUpdate handler for karmor cli tool
func SelfUpdate(c *k8s.Client) error {
func SelfUpdate() error {
var ver = GitSummary
fmt.Printf("current karmor version %s\n", ver)
if !isValidVersion(ver) {
Expand Down

0 comments on commit 72f54ae

Please sign in to comment.