PostgreSQL Parser in Pure Go: No CGO, No External Binaries
Build your own PostgreSQL static analysis by cloning https://github.com/ValkDB/postgresparser and integrating it into your Go tooling.
Clone the repo, run `go build` to compile the parser, and embed it in your linter or CI pipeline to catch SQL issues before deployment.
Summary
The author needed a PostgreSQL parser that could run inside Go tooling without CGO, external binaries, or runtime dependencies. Pure Go was chosen for easy installation, CI compatibility, and embedding in linters. The parser handles PostgreSQL’s many dialect‑specific edge cases, treats AST shape as a product feature, and provides robust error handling. With over 200 GitHub stars, the parser has proven popularity and is now the foundation for Valk Guard, a local‑first static analyzer for SQL and ORM usage. The GitHub repository is https://github.com/ValkDB/postgresparser. The tool is fully self‑contained, requiring no external binaries or CGO, making it ideal for CI pipelines and developer tools.
Key changes
- Pure Go parser with no CGO or external binaries
- Handles PostgreSQL dialect‑specific edge cases and AST shape
- Error handling treated as a product feature
- Over 200 GitHub stars indicating community adoption
- Foundation for Valk Guard static analyzer
- GitHub repo: https://github.com/ValkDB/postgresparser
- No runtime dependencies, CI‑friendly
- Designed for embedding in linters and developer tools