github.com/cockroachdb/cockroach
This package has a good security score with no known vulnerabilities.
Community Reviews
Not a usable Go library - use database/sql driver instead
The '+incompatible' suffix and ancient versioning (19.2.12 from 2021) signal this was never intended for external consumption as a library. If you actually need to connect to CockroachDB from Go, you should use the standard database/sql package with the pgx or pq driver, since CockroachDB is PostgreSQL wire-compatible. The official docs correctly guide you this way, but the presence of this package in module proxies causes confusion.
If you accidentally imported this, your build times will suffer dramatically, and you'll encounter cryptic dependency conflicts with CGO requirements and platform-specific compilation issues. There's no ergonomic API to speak of because this isn't an API - it's a database implementation.
Best for: Contributing to CockroachDB internals or building custom database tooling that needs deep engine access.
Avoid if: You just need to connect your Go application to a CockroachDB instance - use database/sql with pgx/pq driver instead.
Don't import the database server package - use the driver instead
For Go applications needing to connect to CockroachDB, you should use the standard database/sql package with lib/pq (PostgreSQL driver) or pgx. CockroachDB is wire-compatible with PostgreSQL, so these drivers work seamlessly. The server package only makes sense if you're embedding CockroachDB itself or developing server-side extensions, which is extremely rare.
The documentation assumes you want to run or modify CockroachDB itself, not connect to it as a client. Error handling, connection pooling, and retry logic need to be implemented using PostgreSQL patterns. If you accidentally imported this thinking it's a client library, your build times will suffer dramatically and you'll face cryptic dependency conflicts.
Best for: CockroachDB core development, building custom server distributions, or embedding the entire database engine.
Avoid if: You need a client library to connect your Go application to CockroachDB - use lib/pq or pgx instead.
Database server, not a client library - wrong import pattern
For actual CockroachDB connectivity, use the standard database/sql package with pgx or lib/pq drivers since CockroachDB is PostgreSQL wire-compatible. If you need CockroachDB-specific features, use github.com/cockroachdb/cockroach-go which provides utilities like transaction retry helpers and cluster organization tools.
The server codebase itself has strong security practices internally (TLS-first design, robust authentication), but importing it as a dependency exposes your application to hundreds of transitive dependencies, outdated crypto libraries from the freeze date, and potential CVE exposure from dependencies that haven't been updated since 2021. The error handling and internal APIs are designed for database internals, not application development.
Best for: Contributing to CockroachDB server development or building custom database tooling.
Avoid if: You need a client library for your application - use database/sql with pgx driver instead.
Sign in to write a review
Sign In