From 56d257df1d837de8539633bf69fb2ba3ddde53bd Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Thu, 30 Jul 2026 20:36:47 -0500 Subject: [PATCH 1/4] Update Go version to 1.26 Updated Go version from 1.24 to 1.26 in go.mod. --- go.mod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 510a138..740e6f8 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/donatj/sqlread -go 1.24 - -toolchain go1.24.4 +go 1.26 require ( github.com/avvmoto/buf-readerat v0.0.0-20171115124131-a17c8cb89270 From f1e977d852478a4e5435ce5d4f1c519a3e4edaa9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 01:39:43 +0000 Subject: [PATCH 2/4] run go fix ./... for Go 1.26 --- detail.go | 11 ++++++----- parser.go | 13 +++++++------ scanner.go | 17 +++-------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/detail.go b/detail.go index a310d5c..7f922e4 100644 --- a/detail.go +++ b/detail.go @@ -2,6 +2,7 @@ package sqlread import ( "errors" + "strings" ) type InsertDetailParser struct { @@ -82,7 +83,7 @@ func stringValue(c LexItem) (string, error) { d := v[0] m := len(v) - 2 - s := "" + var s strings.Builder i := 0 for { i++ @@ -125,22 +126,22 @@ func stringValue(c LexItem) (string, error) { } i++ - s += string(x) + s.WriteString(string(x)) continue } if v[i] == d { if i+1 < m && v[i+1] == d { i++ - s += string(d) + s.WriteString(string(d)) continue } else { return "", errorInvalidString } } - s += string(v[i]) + s.WriteString(string(v[i])) } - return s, nil + return s.String(), nil } diff --git a/parser.go b/parser.go index 2a62ccd..0bbacb0 100644 --- a/parser.go +++ b/parser.go @@ -3,6 +3,7 @@ package sqlread import ( "fmt" "slices" + "strings" ) // Parser is a state based SQL Parser that reads LexItems on a channel @@ -47,12 +48,12 @@ func (p *Parser) Run(start parseState) error { } func (p *Parser) errorUnexpectedLex(f LexItem, e ...lexItemType) { - s := "" + var s strings.Builder for _, ei := range e { - s += "'" + ei.String() + "' " + s.WriteString("'" + ei.String() + "' ") } - p.err = fmt.Errorf("found '%s'; expected %s at byte: %d", f.Type.String(), s, f.Pos) + p.err = fmt.Errorf("found '%s'; expected %s at byte: %d", f.Type.String(), s.String(), f.Pos) } func (p *Parser) errorUnexpectedEOF() { @@ -63,12 +64,12 @@ func (p *Parser) errorUnexpectedEOF() { // It includes the last position scanned to help with debugging // lastPos is the position of the last valid scanned item func (p *Parser) errorUnexpectedEOFExpectedLexItemType(lastPos int64, e ...lexItemType) { - s := "" + var s strings.Builder for _, ei := range e { - s += "'" + ei.String() + "' " + s.WriteString("'" + ei.String() + "' ") } - p.err = fmt.Errorf("unexpected eof; expected %s starting at byte: %d", s, lastPos+1) + p.err = fmt.Errorf("unexpected eof; expected %s starting at byte: %d", s.String(), lastPos+1) } func isOfAny(c LexItem, l ...lexItemType) bool { diff --git a/scanner.go b/scanner.go index 017eadf..cb416c5 100644 --- a/scanner.go +++ b/scanner.go @@ -2,6 +2,7 @@ package sqlread import ( "io" + "slices" "strings" "unicode/utf8" ) @@ -158,13 +159,7 @@ func (l *lexer) accept(bs []byte) (c int) { for { n := l.next() - found := false - for _, b := range bs { - if b == n { - found = true - break - } - } + found := slices.Contains(bs, n) if !found { l.rewind() @@ -281,11 +276,5 @@ func (l *lexer) emit(t lexItemType) LexItem { } func in(b byte, bs []byte) bool { - for _, bb := range bs { - if b == bb { - return true - } - } - - return false + return slices.Contains(bs, b) } From a7846a73186725bf9475e82a23b4e1e5bfe2c016 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Aug 2026 11:22:22 +0000 Subject: [PATCH 3/4] update go.mod to 1.27 and run go fix ./... Co-authored-by: donatj <133747+donatj@users.noreply.github.com> --- go.mod | 2 +- summary.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 740e6f8..34b99d2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/donatj/sqlread -go 1.26 +go 1.27.0 require ( github.com/avvmoto/buf-readerat v0.0.0-20171115124131-a17c8cb89270 diff --git a/summary.go b/summary.go index 3dc9f02..671e358 100644 --- a/summary.go +++ b/summary.go @@ -73,9 +73,7 @@ func (t *SummaryParser) parseCreateBuilder(start LexItem) parseState { t.Tree[c.Val] = SummaryTable{ Create: c, Cols: make([]SummaryColumn, 0), - SummaryDataLoc: SummaryDataLoc{ - Start: start, - }, + Start: start, } } From 9d7a9b234b0d54ecac298dcb761c0aeab4c916c5 Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Thu, 27 Aug 2026 06:35:44 -0500 Subject: [PATCH 4/4] Apply suggestion from @donatj --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 34b99d2..2b25264 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/donatj/sqlread -go 1.27.0 +go 1.27 require ( github.com/avvmoto/buf-readerat v0.0.0-20171115124131-a17c8cb89270