From 55b5f40cc1f2d42bc3a277f60a3798742ce29170 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Mar 2026 22:54:29 +0200 Subject: 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 --- cmd/perc/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd') 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 -- cgit v1.2.3