From 2bb5e155498651da447f4b87d7309df3b7f4329f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gonz=C3=A1lez=20Di=20Antonio?= Date: Sun, 18 Oct 2026 10:51:06 +0200 Subject: [PATCH] chore: the lexer's builder writes discard what cannot fail golangci-lint's errcheck reported three unchecked strings.Builder writes in the single-quoted string literal loop. A strings.Builder's writes never return an error; the error is discarded on purpose, and the two quotes of an escaped quote are one write. Co-Authored-By: Claude Opus 5.5 --- filter_lexer.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/filter_lexer.go b/filter_lexer.go index a743216..5b6972b 100644 --- a/filter_lexer.go +++ b/filter_lexer.go @@ -142,9 +142,11 @@ func (l *Lexer) Parse() { // Found a quote. Is it an escaped quote ('') or the end? if l.s.Peek() == '\'' { // It's an escaped quote ('') according to SQL standard - l.s.Next() // Consume the second quote from the input stream - sb.WriteRune('\'') // Append a single literal quote to the value - sb.WriteRune('\'') // Append another quote to match the expected format + l.s.Next() // Consume the second quote from the input stream + // Both quotes are kept, as the value is written in SQL. + // A strings.Builder's writes never fail; their error is + // discarded on purpose. + _, _ = sb.WriteString("''") } else { // It's the closing quote break // Exit the loop, string successfully parsed @@ -152,7 +154,7 @@ func (l *Lexer) Parse() { } else { // Regular character within the string // Note: Standard Go escapes like \n are not handled here, only '' for quote escape. - sb.WriteRune(char) + _, _ = sb.WriteRune(char) } }