libs/pubsub/query: specify peg version in go.mod (#9099)

* libs/pubsub/query: specify peg version in go.mod

The code to generate the pubsub queries was dependent on an unspecified
version of the peg tool. This brings peg into go.mod so it is on a fixed
version. This should also enable dependabot to notify us of future
updates to peg.

The version of query.peg.go generated from the current version of peg
correctly contains the special "Code generated by..." line to indicate
to other tools that the file is automatically generated and should
therefore be excluded from linters, etc.

I removed the make target as there were no git grep results referencing
"gen_query_parser"; directly running "go generate" is a reasonable
expectation in Go projects.

Now that "go run" is module aware, I would typically use "go run" inside
the go:generate directive, but in this case we go build to a gitignore-d
directory in order to work around the nondeterministic output detailed
in pointlander/peg#129.

* libs/pubsub/query: check error from (*QueryParser).Init()

The newly generated peg code returns an error from Init(); the previous
version was niladic.

Co-authored-by: Sam Kleinman <garen@tychoish.com>
This commit is contained in:
Mark Rushakoff
2022-07-27 16:35:15 -04:00
committed by GitHub
parent c4e235243b
commit 4309f54349
8 changed files with 290 additions and 504 deletions

1
go.mod
View File

@@ -47,6 +47,7 @@ require (
github.com/bufbuild/buf v1.4.0
github.com/creachadair/taskgroup v0.3.2
github.com/golangci/golangci-lint v1.47.2
github.com/pointlander/peg v1.0.1 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
github.com/vektra/mockery/v2 v2.14.0