google/uuid (Go)
Go package from Google for generating and parsing UUIDs (Universally Unique Identifiers). Supports UUID v1 (time-based), v3 (MD5 namespace), v4 (random), v5 (SHA-1 namespace), and v7 (time-ordered, monotonic). The most widely used UUID library in Go. v7 support (time-sortable UUIDs) added in v1.4+.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Uses crypto/rand for UUID v4 — cryptographically secure random source. No network access.
⚡ Reliability
Best When
Generating standard UUID identifiers in Go services for entities, requests, and distributed IDs.
Avoid When
You need sequential/sortable IDs for database performance — use UUID v7 or ULID instead of v4.
Use Cases
- • Generate random UUID v4 identifiers for database primary keys, request IDs, and entity identifiers
- • Generate time-ordered UUID v7 identifiers for database keys that benefit from sequential insertion ordering
- • Parse UUID strings from API requests with validation: uuid.Parse() returns error for invalid format
- • Use UUID v5 for deterministic namespace-based IDs: same inputs always produce the same UUID
- • Implement distributed ID generation without coordination by using UUID v4 random identifiers
Not For
- • High-performance sequential IDs — use database sequences or distributed ID generators (snowflake, ULID) if UUID randomness causes index fragmentation
- • Human-readable IDs — UUIDs are not human-friendly; use nanoid or short-uuid for user-visible IDs
- • Cryptographically secure tokens — use crypto/rand directly for security tokens; UUID v4 uses CSPRNG but isn't designed for this purpose
Interface
Authentication
Library — no auth needed.
Pricing
BSD 3-Clause licensed Google open source library.
Agent Metadata
Known Gotchas
- ⚠ uuid.New() panics on random number generation failure — use uuid.NewRandom() which returns an error for production code that handles errors
- ⚠ UUID string format includes hyphens: '550e8400-e29b-41d4-a716-446655440000' — storing without hyphens requires manual stripping
- ⚠ UUID comparisons must use == operator on uuid.UUID type, not string comparison, to avoid case sensitivity issues
- ⚠ uuid.Parse() is case-insensitive for hex digits — '550E8400-...' and '550e8400-...' are equal after parsing
- ⚠ UUID v7 requires v1.4+ of the library — check version compatibility when using time-sortable UUIDs
- ⚠ Scanning UUIDs from SQL databases requires Scan() method or using uuid.UUID as the target type — sql.Scan treats UUID as [16]byte internally
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for google/uuid (Go).
Scores are editorial opinions as of 2026-03-06.