on main help sign in
refactor: simplify code with `cmp.Or`
commit0ca5de0e6d43377deb275b1abcb3c9f682dc4244 authorAndrey Nering <andreynering@users.noreply.github.com> dateFri 24 Oct 2025, 17:51 (1 year ago) parent964cacd
1 file changed+3−8
internal/agent/prompt/prompt.go+3−8
internal/agent/prompt/prompt.go+3−8
@@ -1,6 +1,7 @@
11package prompt
22
33import (
4+ "cmp"
45 "context"
56 "fmt"
67 "os"
@@ -146,14 +147,8 @@ func expandPath(path string, cfg config.Config) string {
146147}
147148
148149func (p *Prompt) promptData(ctx context.Context, provider, model string, cfg config.Config) (PromptDat, error) {
149− workingDir := cfg.WorkingDir()
150− if p.workingDir != "" {
151− workingDir = p.workingDir
152− }
153− platform := runtime.GOOS
154− if p.platform != "" {
155− platform = p.platform
156− }
150+ workingDir := cmp.Or(p.workingDir, cfg.WorkingDir())
151+ platform := cmp.Or(p.platform, runtime.GOOS)
157152
158153 files := map[string][]ContextFile{}
159154