Skip to content

Commit

Permalink
Inline errors
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Sep 13, 2023
1 parent 3dcf31d commit 944a86b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
33 changes: 13 additions & 20 deletions cmd/apps/grafana_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,28 @@ func MakeInstallGrafana() *cobra.Command {
"Use custom flags or override existing flags \n(example --set persistence.enabled=true)")

grafana.PreRunE = func(command *cobra.Command, args []string) error {
_, err := command.Flags().GetString("kubeconfig")
if err != nil {
return fmt.Errorf("error with --kubeconfig usage: %s", err)
if _, err := command.Flags().GetString("kubeconfig"); err != nil {
return fmt.Errorf("error with --kubeconfig usage: %w", err)
}

_, err = command.Flags().GetBool("wait")
if err != nil {
return fmt.Errorf("error with --wait usage: %s", err)
if _, err := command.Flags().GetBool("wait"); err != nil {
return fmt.Errorf("error with --wait usage: %w", err)
}

_, err = command.Flags().GetBool("persistence")
if err != nil {
return fmt.Errorf("error with --persistence usage: %s", err)
if _, err := command.Flags().GetBool("persistence"); err != nil {
return fmt.Errorf("error with --persistence usage: %w", err)
}

_, err = command.Flags().GetString("namespace")
if err != nil {
return fmt.Errorf("error with --namespace usage: %s", err)
if _, err := command.Flags().GetString("namespace"); err != nil {
return fmt.Errorf("error with --namespace usage: %w", err)
}

_, err = command.Flags().GetBool("update-repo")
if err != nil {
return fmt.Errorf("error with --update-repo usage: %s", err)
if _, err := command.Flags().GetBool("update-repo"); err != nil {
return fmt.Errorf("error with --update-repo usage: %w", err)
}

_, err = command.Flags().GetStringArray("set")
if err != nil {
return fmt.Errorf("error with --set usage: %s", err)
if _, err := command.Flags().GetStringArray("set"); err != nil {
return fmt.Errorf("error with --set usage: %w", err)
}

return nil
Expand Down Expand Up @@ -106,8 +100,7 @@ func MakeInstallGrafana() *cobra.Command {
WithKubeconfigPath(kubeConfigPath).
WithWait(wait)

_, err := apps.MakeInstallChart(grafanaAppOptions)
if err != nil {
if _, err := apps.MakeInstallChart(grafanaAppOptions); err != nil {
return err
}

Expand Down
1 change: 0 additions & 1 deletion pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func AddHelmRepo(name, url string, update bool) error {
StreamStdio: true,
}
res, err := task.Execute()

if err != nil {
return err
}
Expand Down

0 comments on commit 944a86b

Please sign in to comment.