summaryrefslogtreecommitdiff
path: root/internal/hexaiaction
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-11-02 23:42:15 +0200
committerPaul Buetow <paul@buetow.org>2025-11-02 23:42:15 +0200
commit35e1de6f975088ade5dbf0af533fe6fdac8fcc94 (patch)
treec9fc9b6ad86cc10a777b3f510c3c4b2d62c41ebd /internal/hexaiaction
parentc60d5703d25b7d76d1da2f368b0632f08a161644 (diff)
some linter fixes
Diffstat (limited to 'internal/hexaiaction')
-rw-r--r--internal/hexaiaction/cmdentry.go4
-rw-r--r--internal/hexaiaction/cmdentry_test.go6
-rw-r--r--internal/hexaiaction/run.go12
-rw-r--r--internal/hexaiaction/tui_delegate.go2
4 files changed, 14 insertions, 10 deletions
diff --git a/internal/hexaiaction/cmdentry.go b/internal/hexaiaction/cmdentry.go
index ca33443..7d91ab2 100644
--- a/internal/hexaiaction/cmdentry.go
+++ b/internal/hexaiaction/cmdentry.go
@@ -160,8 +160,8 @@ func catFileTo(w io.Writer, path string) error {
// echoThrough no longer used in tmux-only flow, but kept for potential reuse.
func echoThrough(infile, outfile string, stdin io.Reader, stdout io.Writer) error {
- var in io.Reader = stdin
- var out io.Writer = stdout
+ in := stdin
+ out := stdout
if infile != "" {
f, err := os.Open(infile)
if err != nil {
diff --git a/internal/hexaiaction/cmdentry_test.go b/internal/hexaiaction/cmdentry_test.go
index 9c896f6..71ed9db 100644
--- a/internal/hexaiaction/cmdentry_test.go
+++ b/internal/hexaiaction/cmdentry_test.go
@@ -24,7 +24,11 @@ func TestPersistStdin_WritesFile(t *testing.T) {
t.Fatalf("write src: %v", err)
}
f, _ := os.Open(src)
- defer f.Close()
+ defer func() {
+ if err := f.Close(); err != nil {
+ t.Errorf("failed to close temp file: %v", err)
+ }
+ }()
if err := persistStdin(path, f); err != nil {
t.Fatalf("persistStdin: %v", err)
}
diff --git a/internal/hexaiaction/run.go b/internal/hexaiaction/run.go
index 2a1f940..bf355b0 100644
--- a/internal/hexaiaction/run.go
+++ b/internal/hexaiaction/run.go
@@ -36,7 +36,7 @@ func Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error {
stats.SetWindow(time.Duration(cfg.StatsWindowMinutes) * time.Minute)
}
if err := cfg.Validate(); err != nil {
- fmt.Fprintf(stderr, logging.AnsiBase+"hexai-tmux-action: %v"+logging.AnsiReset+"\n", err)
+ _, _ = fmt.Fprintf(stderr, logging.AnsiBase+"hexai-tmux-action: %v"+logging.AnsiReset+"\n", err)
return err
}
// Enable custom action submenu with configurable hotkey
@@ -50,7 +50,7 @@ func Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error {
}
cli, err := newClientFromApp(cfg)
if err != nil {
- fmt.Fprintf(stderr, logging.AnsiBase+"hexai-tmux-action: LLM disabled: %v"+logging.AnsiReset+"\n", err)
+ _, _ = fmt.Fprintf(stderr, logging.AnsiBase+"hexai-tmux-action: LLM disabled: %v"+logging.AnsiReset+"\n", err)
return err
}
primaryModel := strings.TrimSpace(reqOptsFrom(cfg).model)
@@ -61,7 +61,7 @@ func Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error {
var client chatDoer = cli
parts, err := ParseInput(stdin)
if err != nil {
- fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: failed to read input"+logging.AnsiReset)
+ _, _ = fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: failed to read input"+logging.AnsiReset)
return err
}
if strings.TrimSpace(parts.Selection) == "" {
@@ -75,7 +75,7 @@ func Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error {
if err != nil {
return err
}
- io.WriteString(stdout, out)
+ _, _ = io.WriteString(stdout, out)
return nil
}
@@ -123,7 +123,7 @@ func executeAction(ctx context.Context, kind ActionKind, parts InputParts, cfg a
func handleRewriteAction(ctx context.Context, parts InputParts, cfg appconfig.App, client chatDoer, stderr io.Writer) (string, error) {
instr, cleaned := ExtractInstruction(parts.Selection)
if strings.TrimSpace(instr) == "" {
- fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: no inline instruction found; echoing input"+logging.AnsiReset)
+ _, _ = fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: no inline instruction found; echoing input"+logging.AnsiReset)
return parts.Selection, nil
}
return runWithTimeout(ctx, timeout10s, func(cctx context.Context) (string, error) {
@@ -169,7 +169,7 @@ func handleCustomAction(ctx context.Context, parts InputParts, cfg appconfig.App
func handleCustomPromptAction(ctx context.Context, parts InputParts, cfg appconfig.App, client chatDoer, stderr io.Writer) (string, error) {
prompt, err := editor.OpenTempAndEdit(nil)
if err != nil || strings.TrimSpace(prompt) == "" {
- fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: custom prompt canceled or empty; echoing input"+logging.AnsiReset)
+ _, _ = fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: custom prompt canceled or empty; echoing input"+logging.AnsiReset)
return parts.Selection, nil
}
return runWithTimeout(ctx, timeout10s, func(cctx context.Context) (string, error) {
diff --git a/internal/hexaiaction/tui_delegate.go b/internal/hexaiaction/tui_delegate.go
index 46d40cb..0b34d7e 100644
--- a/internal/hexaiaction/tui_delegate.go
+++ b/internal/hexaiaction/tui_delegate.go
@@ -31,5 +31,5 @@ func (oneLineDelegate) Render(w io.Writer, m list.Model, index int, listItem lis
if index == m.Index() {
cursor = cursorStyle.Render("> ")
}
- fmt.Fprintf(w, "%s%s%s", cursor, title, hot)
+ _, _ = fmt.Fprintf(w, "%s%s%s", cursor, title, hot)
}