Commit 3ef7510
committed
Add CGO build constraints for DuckDB support
DuckDB requires CGO (via go-duckdb C bindings), but CI builds with
CGO_ENABLED=0. This commit adds proper build constraints to ensure
sqlc builds successfully with or without CGO.
Changes:
- Move go-duckdb import to separate files with //go:build cgo constraint
- internal/cmd/vet_duckdb.go: DuckDB driver import (only with CGO)
- internal/engine/duckdb/analyzer/driver.go: DuckDB driver import (only with CGO)
- Remove go-duckdb import from main vet.go and analyze.go files
Build verification:
✅ CGO_ENABLED=1: Full DuckDB support, 121MB binary
✅ CGO_ENABLED=0: DuckDB excluded, 73MB binary (48MB smaller)
✅ Tests pass with CGO enabled
✅ Build succeeds with CGO disabled (CI requirement)
The cgo build tag automatically excludes these files when CGO is disabled,
allowing sqlc to build on all platforms while providing DuckDB support
when CGO is available.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 0334db5 commit 3ef7510
File tree
4 files changed
+14
-3
lines changed- internal
- cmd
- engine/duckdb/analyzer
4 files changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments