diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-26 09:44:22 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-26 09:44:22 +0200 |
| commit | 0bf0381232019fbda419447166d021d8e0852317 (patch) | |
| tree | 8ce53c7c93851020c57fb547f3237fb42c1c3290 | |
| parent | f3cf44b961ea3baef4e8150a6ce88add84970212 (diff) | |
fix: address code quality issues from golangci-lint
- Fix error handling in test files by explicitly ignoring error returns
- Remove trailing punctuation from error message in rpn_parse.go
Test file changes:
- cli_test.go: Use _ = os.Remove() in Cleanup function
- concurrent_test.go: Use _, _ = runRPN() in concurrent goroutines
Code change:
- rpn_parse.go: Changed error message to end with 'colon' instead of ':'
| -rw-r--r-- | cmd/gt/cli_test.go | 3 | ||||
| -rw-r--r-- | internal/repl/concurrent_test.go | 6 | ||||
| -rw-r--r-- | internal/rpn/rpn_parse.go | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/cmd/gt/cli_test.go b/cmd/gt/cli_test.go index e725de9..46d9e82 100644 --- a/cmd/gt/cli_test.go +++ b/cmd/gt/cli_test.go @@ -27,7 +27,8 @@ func buildBinary(t *testing.T) string { } t.Cleanup(func() { - os.Remove("/tmp/gt-test") + // Explicitly ignore error return from os.Remove during cleanup + _ = os.Remove("/tmp/gt-test") }) return "/tmp/gt-test" diff --git a/internal/repl/concurrent_test.go b/internal/repl/concurrent_test.go index 14c82ef..d07b9ce 100644 --- a/internal/repl/concurrent_test.go +++ b/internal/repl/concurrent_test.go @@ -25,7 +25,8 @@ func TestConcurrentRPN(t *testing.T) { wg.Add(1) go func(id int) { defer wg.Done() - runRPN("3 4 +") + // Ignore error return as the expression "3 4 +" should always succeed + _, _ = runRPN("3 4 +") }(i) } wg.Wait() @@ -55,7 +56,8 @@ func TestConcurrentExecutorAndRPN(t *testing.T) { }(i) go func(id int) { defer wg.Done() - runRPN("3 4 +") + // Ignore error return as the expression "3 4 +" should always succeed + _, _ = runRPN("3 4 +") }(i) } wg.Wait() diff --git a/internal/rpn/rpn_parse.go b/internal/rpn/rpn_parse.go index 48abb15..bf9a613 100644 --- a/internal/rpn/rpn_parse.go +++ b/internal/rpn/rpn_parse.go @@ -445,7 +445,7 @@ func (r *RPN) handleOperator(stack *Stack, token string, tokenIndex int) (string if len(token) > 0 && token[0] == ':' { symbolName := token[1:] // Remove the leading : if symbolName == "" { - return "", fmt.Errorf("symbol name cannot be empty after :") + return "", fmt.Errorf("symbol name cannot be empty after colon") } // Only push as symbol if the remaining part is a valid identifier // This prevents := and =: from being treated as : followed by = operator |
