summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-26 09:44:22 +0200
committerPaul Buetow <paul@buetow.org>2026-03-26 09:44:22 +0200
commit0bf0381232019fbda419447166d021d8e0852317 (patch)
tree8ce53c7c93851020c57fb547f3237fb42c1c3290
parentf3cf44b961ea3baef4e8150a6ce88add84970212 (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.go3
-rw-r--r--internal/repl/concurrent_test.go6
-rw-r--r--internal/rpn/rpn_parse.go2
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