Skip to content

Commit

Permalink
fix 🐛: lint error for static check
Browse files Browse the repository at this point in the history
  • Loading branch information
muandane committed Dec 12, 2023
1 parent 2ff85a6 commit 43bc2e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
24 changes: 20 additions & 4 deletions cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,29 @@ PowerShell:
Run: func(cmd *cobra.Command, args []string) {
switch args[0] {
case "bash":
rootCmd.GenBashCompletion(os.Stdout)
err := rootCmd.GenBashCompletion(os.Stdout)
if err != nil {
fmt.Println("Error generating bash completion:", err)
return
}
case "zsh":
rootCmd.GenZshCompletion(os.Stdout)
err := rootCmd.GenZshCompletion(os.Stdout)
if err != nil {
fmt.Println("Error generating zsh completion:", err)
return
}
case "fish":
rootCmd.GenFishCompletion(os.Stdout, true)
err := rootCmd.GenFishCompletion(os.Stdout, true)
if err != nil {
fmt.Println("Error generating fish completion:", err)
return
}
case "powershell":
rootCmd.GenPowerShellCompletionWithDesc(os.Stdout)
err := rootCmd.GenPowerShellCompletionWithDesc(os.Stdout)
if err != nil {
fmt.Println("Error generating powershell completion:", err)
return
}
}
},
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"fmt"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -264,7 +265,11 @@ func TestLoadConfig_Failure1(t *testing.T) {
defer os.RemoveAll(tmpDir)

// Change the working directory to the temporary directory
os.Chdir(tmpDir)
err = os.Chdir(tmpDir)
if err != nil {
fmt.Println("Error while changing working directory to the temporary directory:", err)
return
}
// Try to load a non-existent config file
_, err = LoadConfig("non_existent_file.json")
if err == nil {
Expand Down

0 comments on commit 43bc2e2

Please sign in to comment.