deps: migrate lib/pq → pgx/v5 + go mod tidy (RUK-135) - #21
Merged
Conversation
TD-12: lib/pq has been in maintenance mode since 2020. Migrated the
runtime PG driver to github.com/jackc/pgx/v5/stdlib, which is the
active fork the ecosystem has rallied behind.
What changed:
- pkg/goquestorage imports pgx/v5/stdlib (anonymous), so the "pgx"
driver registers automatically for anyone using this package.
- New PgxDriver = "pgx" and PgxV5Driver = "pgx/v5" constants for the
two names pgx registers itself under.
- PgDriver = "postgres" stays as a // Deprecated: alias. goquestorage
no longer registers "postgres" — callers using this name must
`_ "github.com/lib/pq"` in their own code. This is intentional:
silently aliasing "postgres" to pgx inside the package would race
with downstream binaries that also import lib/pq (panic on
double-Register or silent type-mismatch in error handling,
depending on init() order).
- goque.NewStorage's switch accepts all three names.
- internal/storages/pg/task/add_task.go handleError uses
*pgconn.PgError + pgerrcode constants (UniqueViolation,
InvalidTextRepresentation) instead of *pq.Error + Code.Name().
- examples/service migrated to "pgx" — both config.yaml and the
config.go default.
- scripts/dbmodels/generate.go (dev-only jet code generator): jet's
GenerateDSN is hard-coded to sql.Open("postgres", ...); rather
than bring lib/pq back, we open via sqlx with "pgx" and pass jet
the embedded *sql.DB through GenerateDB. MySQL and SQLite paths
unchanged — jet self-imports their drivers.
TD-13 (go mod tidy): cron/v3 moved from indirect to direct (we use
it in periodic processors). pgerrcode added as a small direct dep.
lib/pq stays as `indirect` because go-jet/v2/postgres runtime package
pulls it transitively — out of our control without replacing jet.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TD-12: lib/pq has been in maintenance mode since 2020. Migrated the
runtime PG driver to github.com/jackc/pgx/v5/stdlib, which is the
active fork the ecosystem has rallied behind.
What changed:
driver registers automatically for anyone using this package.
two names pgx registers itself under.
no longer registers "postgres" — callers using this name must
_ "github.com/lib/pq"in their own code. This is intentional:silently aliasing "postgres" to pgx inside the package would race
with downstream binaries that also import lib/pq (panic on
double-Register or silent type-mismatch in error handling,
depending on init() order).
*pgconn.PgError + pgerrcode constants (UniqueViolation,
InvalidTextRepresentation) instead of *pq.Error + Code.Name().
config.go default.
GenerateDSN is hard-coded to sql.Open("postgres", ...); rather
than bring lib/pq back, we open via sqlx with "pgx" and pass jet
the embedded *sql.DB through GenerateDB. MySQL and SQLite paths
unchanged — jet self-imports their drivers.
TD-13 (go mod tidy): cron/v3 moved from indirect to direct (we use
it in periodic processors). pgerrcode added as a small direct dep.
lib/pq stays as
indirectbecause go-jet/v2/postgres runtime packagepulls it transitively — out of our control without replacing jet.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com