fix: all issues by golangci-lint

This commit is contained in:
verse91
2026-05-09 23:49:33 +07:00
parent e587f02798
commit c76541258a
18 changed files with 118 additions and 79 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ var DebugWriter io.Writer
func debugLog(format string, a ...interface{}) {
if DebugWriter != nil {
fmt.Fprintf(DebugWriter, format+"\n", a...)
_, _ = fmt.Fprintf(DebugWriter, format+"\n", a...)
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
package dev
import (
"context"
"os/exec"
"strings"
@@ -50,7 +51,7 @@ func GitPushPullGenerator(tokens []string, prefix string, partial string) []core
func getGitResults(prefix string, args ...string) []core.Suggestion {
cwd := core.GetCWD()
cmd := exec.Command("git", args...)
cmd := exec.CommandContext(context.Background(), "git", args...)
cmd.Dir = cwd
out, err := cmd.Output()
if err != nil {
+3 -5
View File
@@ -6,6 +6,7 @@ package fs
import (
"bytes"
"context"
"os"
"os/exec"
"strings"
@@ -35,7 +36,7 @@ func ZoxideGenerator() core.GeneratorFunc {
localSuggestions := core.FileGenerator("/")(tokens, prefix, fullQuery)
var zoxideSuggestions []core.Suggestion
cmd := exec.Command("zoxide", "query", "-l")
cmd := exec.CommandContext(context.Background(), "zoxide", "query", "-l")
out, err := cmd.Output()
if err == nil {
lines := strings.Split(string(bytes.TrimSpace(out)), "\n")
@@ -79,10 +80,7 @@ func ZoxideGenerator() core.GeneratorFunc {
var finalResults []core.Suggestion
seen := make(map[string]bool)
for _, s := range localSuggestions {
finalResults = append(finalResults, s)
}
finalResults = append(finalResults, localSuggestions...)
for _, s := range zoxideSuggestions {
if !seen[s.Cmd] {
+1 -1
View File
@@ -23,7 +23,7 @@ func init() {
return nil
}
}
defer file.Close()
defer func() { _ = file.Close() }()
var suggestions []core.Suggestion
seen := make(map[string]bool)
+1 -1
View File
@@ -19,7 +19,7 @@ func init() {
// No Makefile, don't pretend we have one
return nil
}
defer file.Close()
defer func() { _ = file.Close() }()
var suggestions []core.Suggestion
seen := make(map[string]bool)