From c57453be90bb4496f67275db8c0beb2116a6ce14 Mon Sep 17 00:00:00 2001 From: yory8 <> Date: Fri, 8 Nov 2019 13:22:36 +0100 Subject: [PATCH] refac: apply staticcheck --- main.go | 2 +- selector.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index ad800a9..bc8a81a 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ var ( clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool() - restorer = app.Command("restore", "Serve the last recorded item from history") + _ = app.Command("restore", "Serve the last recorded item from history") ) func main() { diff --git a/selector.go b/selector.go index 45805f0..a4a285c 100644 --- a/selector.go +++ b/selector.go @@ -43,7 +43,7 @@ func selector(data []string, max int, tool string, prompt string, toolsArgs stri case "wofi": args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"} default: - return "", fmt.Errorf("Unsupported tool: %s", tool) + return "", fmt.Errorf("unsupported tool: %s", tool) } args = append(args, strings.Fields(toolsArgs)...) @@ -66,9 +66,7 @@ func selector(data []string, max int, tool string, prompt string, toolsArgs stri return "", nil } - selected := string(b[:len(b)-1]) // drop newline added by dmenu/rofi/wofi - - sel, ok := guide[selected] + sel, ok := guide[string(b[:len(b)-1])] // drop newline added by dmenu/roi/wofi if !ok { return "", errors.New("couldn't recover original string") }