From 0ca5de0e6d43377deb275b1abcb3c9f682dc4244 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Fri, 24 Oct 2025 17:51:32 -0300 Subject: [PATCH] refactor: simplify code with `cmp.Or` --- internal/agent/prompt/prompt.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/agent/prompt/prompt.go b/internal/agent/prompt/prompt.go index efbe78665915831262223f644854bf630c67be34..b40c0eaa554eb4ca3cce32cd9c4214afc5633e61 100644 --- a/internal/agent/prompt/prompt.go +++ b/internal/agent/prompt/prompt.go @@ -1,6 +1,7 @@ package prompt import ( + "cmp" "context" "fmt" "os" @@ -146,14 +147,8 @@ func expandPath(path string, cfg config.Config) string { } func (p *Prompt) promptData(ctx context.Context, provider, model string, cfg config.Config) (PromptDat, error) { - workingDir := cfg.WorkingDir() - if p.workingDir != "" { - workingDir = p.workingDir - } - platform := runtime.GOOS - if p.platform != "" { - platform = p.platform - } + workingDir := cmp.Or(p.workingDir, cfg.WorkingDir()) + platform := cmp.Or(p.platform, runtime.GOOS) files := map[string][]ContextFile{}