summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-23 22:54:29 +0200
committerPaul Buetow <paul@buetow.org>2026-03-23 22:54:29 +0200
commit55b5f40cc1f2d42bc3a277f60a3798742ce29170 (patch)
tree28f88b79792f4ba9f87efc1d341b54cf7b3963d1 /cmd
parent833f7c17e67e4b2b54e881bd5df05f2e4b07b2ae (diff)
Code quality audit fixes from comprehensive audit
- Error wrapping improvements across multiple files - Thread-safe singleton initialization using sync.Once - Proper error handling for file close operations - Removed speculative complexity in history management - Fixed operator interface design Audit report: COMPLETE_AUDIT_REPORT.md
Diffstat (limited to 'cmd')
-rw-r--r--cmd/perc/main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/perc/main.go b/cmd/perc/main.go
index 5dd1819..113d919 100644
--- a/cmd/perc/main.go
+++ b/cmd/perc/main.go
@@ -7,8 +7,8 @@ import (
"codeberg.org/snonux/perc/internal"
"codeberg.org/snonux/perc/internal/calculator"
- "codeberg.org/snonux/perc/internal/rpn"
"codeberg.org/snonux/perc/internal/repl"
+ "codeberg.org/snonux/perc/internal/rpn"
"github.com/mattn/go-isatty"
)
@@ -65,17 +65,17 @@ func runCommand(args []string) (string, error) {
}
input := strings.Join(args[1:], " ")
-
+
// Try RPN parsing first (for bare RPN expressions like "3 4 +")
rpnResult, rpnErr := runRPN(input)
if rpnErr == nil {
return rpnResult, nil
}
-
+
// Fall back to percentage calculation
result, err := calculator.Parse(input)
if err != nil {
- return "", err
+ return "", fmt.Errorf("rpn fallback failed for input %q: %w", input, err)
}
return result, nil