fix: all issues by golangci-lint
This commit is contained in:
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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] {
|
||||
|
||||
@@ -23,7 +23,7 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() { _ = file.Close() }()
|
||||
|
||||
var suggestions []core.Suggestion
|
||||
seen := make(map[string]bool)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user