Skip to content

Commit a33324e

Browse files
sqlparser: extract goyacc into github.com/vitessio/goyacc (#19706)
Signed-off-by: Arthur Schreiber <arthur@planetscale.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3e92db9 commit a33324e

6 files changed

Lines changed: 10 additions & 3735 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ linters:
4343
list-mode: lax
4444
files:
4545
- "**/go/vt/sqlparser/**"
46-
- "!**/go/vt/sqlparser/goyacc/**"
4746
deny:
4847
- pkg: github.com/spf13/pflag
49-
desc: "sqlparser package should not depend on pflag except in goyacc subpackage - this component should be usable as a library with explicit configuration, not global flags"
48+
desc: "sqlparser package should not depend on pflag - this component should be usable as a library with explicit configuration, not global flags"
5049
- pkg: vitess.io/vitess/go/vt/servenv
5150
desc: "sqlparser should not depend on servenv - this component should be usable as a library without server infrastructure dependencies"
5251
schemadiff_package_restrictions:
@@ -163,9 +162,6 @@ linters:
163162
- linters:
164163
- errcheck
165164
path: ^go/vt/sqlparser/(ast_format|ast_format_fast).go
166-
- linters:
167-
- errcheck
168-
path: ^go/vt/sqlparser/goyacc
169165
- linters:
170166
- errcheck
171167
path: ^go/vt/throttler/.*_test.go

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module vitess.io/vitess
33
go 1.26.1
44

55
tool (
6+
github.com/vitessio/goyacc
67
gotest.tools/gotestsum
78
mvdan.cc/gofumpt
89
)
@@ -162,6 +163,7 @@ require (
162163
github.com/sirupsen/logrus v1.9.3 // indirect
163164
github.com/theckman/httpforwarded v0.4.0 // indirect
164165
github.com/vbatts/tar-split v0.12.2 // indirect
166+
github.com/vitessio/goyacc v0.0.0-20260324145439-055d41417f4e // indirect
165167
go.opentelemetry.io/collector/component v1.42.0 // indirect
166168
go.opentelemetry.io/collector/featuregate v1.42.0 // indirect
167169
go.opentelemetry.io/collector/internal/telemetry v0.136.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVK
616616
github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
617617
github.com/vbatts/tar-split v0.12.2 h1:w/Y6tjxpeiFMR47yzZPlPj/FcPLpXbTUi/9H7d3CPa4=
618618
github.com/vbatts/tar-split v0.12.2/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA=
619+
github.com/vitessio/goyacc v0.0.0-20260324145439-055d41417f4e h1:Pq1r4srNEsHShNMe/lMSSJYae8rWWtg9QEBLSIb1Np0=
620+
github.com/vitessio/goyacc v0.0.0-20260324145439-055d41417f4e/go.mod h1:w29qJNNyzpk4XIcE7g1WwTiv2uCBVaQPFoE5p6mZG+0=
619621
github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI=
620622
github.com/vmihailenco/msgpack/v4 v4.3.13/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
621623
github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=

go/vt/sqlparser/generate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ package sqlparser
1818

1919
// Generate all the AST helpers using the tooling in `go/tools`
2020

21-
//go:generate go run ./goyacc -fo sql.go sql.y
21+
//go:generate go run github.com/vitessio/goyacc -fo sql.go sql.y
22+
//go:generate go run golang.org/x/tools/cmd/goimports@034e59c473362f8f2be47694d98fd3f12a1ad497 -local vitess.io/vitess -w sql.go
23+
//go:generate go tool gofumpt -w sql.go
2224
//go:generate go run ../../tools/asthelpergen/main --in . --iface vitess.io/vitess/go/vt/sqlparser.SQLNode --clone_exclude "*ColName" --equals_custom "*ColName"
2325
//go:generate go run ../../tools/astfmtgen vitess.io/vitess/go/vt/sqlparser/...

0 commit comments

Comments
 (0)