Skip to content

Fix govulncheck failure by removing lib/pq from default builds - #4566

Merged
kyleconroy merged 1 commit into
mainfrom
claude/vuln-check-failure-mtibgm
Aug 18, 2026
Merged

Fix govulncheck failure by removing lib/pq from default builds#4566
kyleconroy merged 1 commit into
mainfrom
claude/vuln-check-failure-mtibgm

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

The vuln_check CI job fails on seven github.com/lib/pq vulnerabilities (GO-2026-6166 through GO-2026-6171), all reported as Fixed in: N/A — there is no upstream release to bump to, so the only fix is to stop linking lib/pq into the code govulncheck scans.

The sqlc binary never uses lib/pq; only two spots in the module pulled it into the default (untagged) build that govulncheck analyzes:

  • internal/sqltest/postgres.go registered the lib/pq driver, but its helpers (sqltest.PostgreSQL, sqltest.CreatePostgreSQLDatabase) no longer have any callers — everything moved to sqltest/local, which uses pgx. Deleted the file and moved the id() helper into mysql.go, which still uses it.
  • examples/ondeck/postgresql generated code imports lib/pq for pq.Array. Its tests are already behind the examples build tag, so this sets "build_tags": "examples" for that package in sqlc.json and regenerates, putting the generated files behind the same tag as the tests that exercise them. The regenerated diff is exactly the //go:build examples header on five files.

lib/pq stays in go.mod for the --tags=examples test build; govulncheck now reports it only as a required-but-uncalled module, which is informational and doesn't fail the check.

Verification

  • govulncheck ./... (with go1.26.6): 0 called vulnerabilities (was 7)
  • go build ./... and go vet ./... pass with and without -tags=examples
  • go mod tidy is a no-op
  • Live-database runs pass: examples/ondeck (postgresql, mysql, sqlite), authors, booktest, batch example tests, plus TestExamples, TestExamplesVet/ondeck, TestJsonSchema, and the config package tests

🤖 Generated with Claude Code

https://claude.ai/code/session_011mXrXXbgLobj5jpsyzJqB8


Generated by Claude Code

govulncheck fails on seven unpatched lib/pq vulnerabilities
(GO-2026-6166 through GO-2026-6171). All of them are reported with
'Fixed in: N/A', so bumping the dependency cannot fix the check.

The sqlc binary itself never uses lib/pq; the module only linked it in
two places that govulncheck's default (untagged) scan could see:

- internal/sqltest/postgres.go registered the lib/pq driver, but its
  helpers (PostgreSQL, CreatePostgreSQLDatabase) have no callers left,
  so delete the file and move the id() helper to mysql.go, which still
  uses it.

- examples/ondeck/postgresql generated code imports lib/pq for
  pq.Array. Its tests are already build-tagged 'examples', so set
  build_tags: examples for the package in sqlc.json and regenerate,
  putting the generated files behind the same tag as the tests that
  exercise them.

With no lib/pq import left in the default build, govulncheck reports
zero called vulnerabilities; lib/pq remains a module requirement for
the examples-tagged tests, which is informational only.

Verified with govulncheck ./... (0 findings), go build/vet with and
without the examples tag, and the example test suites against live
PostgreSQL and MySQL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mXrXXbgLobj5jpsyzJqB8
@kyleconroy
kyleconroy merged commit e76cf63 into main Aug 18, 2026
13 checks passed
@kyleconroy
kyleconroy deleted the claude/vuln-check-failure-mtibgm branch August 18, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants