# Top Go Libraries by Category ## Web Frameworks **Gin** () High-performance HTTP web framework with minimalist API. Up to 40x faster than some alternatives. Great for building REST APIs and microservices. **Echo** () Minimalist, extensible web framework. Clean middleware system, excellent performance. Good for both REST APIs and traditional web apps. **Fiber** () Express.js-inspired web framework built on Fasthttp. Very fast, easy for Node.js developers transitioning to Go. **Chi** () Lightweight, idiomatic router that composes well with net/http. Minimal dependencies, great for smaller projects. ## HTTP Clients **Resty** () Simple HTTP and REST client for Go. Inspired by Ruby's rest-client. Great for API consumption with retry support. **Req** () Simple Go HTTP client with "black magic" - less code, more efficiency. Clean API for common operations. ## ORM & Database **GORM** () Feature-complete ORM library. Developer-friendly, supports associations, hooks, auto-migrations. The most popular Go ORM. **SQLx** () Extensions for database/sql that provide convenience while maintaining power. Type-safe, performant query helpers. **Ent** () Entity framework for Go. Code-generated, type-safe ORM with excellent support for complex queries and graph traversals. **Sqlc** () Generate type-safe Go code from SQL. No runtime reflection, compiler-checked queries. ## Database Drivers **go-sql-driver/mysql** () MySQL driver for Go's database/sql package. Maintained by the Go team, reliable and performant. **lib/pq** () Pure Go PostgreSQL driver. The gold standard for PostgreSQL in Go. **pgx** () PostgreSQL driver with advanced features. Faster than lib/pq, supports all PostgreSQL types. **redis-go** () Redis client for Go. Cluster support, modern Redis features, well-maintained. **mongo-go-driver** () Official MongoDB driver for Go. Supports async operations, transactions (in newer versions). ## Testing **Testify** () Sacred extension to the testing package. Assertions, mocking, suite testing. Essential for Go testing. **gomock** () Mocking framework for Go interfaces. Widely used, integrates well with testing package. **go-sqlmock** () SQL mock driver for testing database operations. Test database code without a real database. **testcontainers-go** () Integration testing with real dependencies in Docker containers. Spin up databases, message queues, etc. **httptest** (standard library) Testing HTTP servers/clients. Built into Go, no external dependency needed. ## Command Line and Configuration **Cobra** () Commander for modern Go CLI applications. Powerful subcommand system, flags, auto-generated docs. Industry standard for CLIs. **Viper** () Go configuration with fangs. Works with Cobra, supports multiple formats (JSON, YAML, TOML, env). **urfave/cli** () Simple, fast, fun package for building command line apps. Alternative to Cobra. **Koanf** () Lightweight, extensible library for reading config. Support for JSON, YAML, TOML, env, command line. **env** (from ) Parse environment variables into Go structs with defaults. Simple, type-safe, no struct tags. ## Logging **Zap** () Fast, structured, leveled logging. Uber's production logger, zero-allocation in hot paths. **Zerolog** () Zero-allocation JSON logging. Very fast, simple API, leveled logging. **Logrus** () Structured logger for Go. Mature, widely-used, plugin architecture. Note: deprecated in favor of structured logging. ## Validation **validator** () Go struct validation. Tags-based, extensive validators, cross-field validation. **ozzo-validation** () Fast validation library. Modern alternative for struct validation. ## JSON Processing **jsoniter** () High-performance 100% compatible drop-in replacement for encoding/json. Faster JSON parsing. ## Authentication & Authorization **Casbin** () Authorization library supporting ACL, RBAC, ABAC. Policy-based access control. **JWT** () JSON Web Token implementation for Go. Full-featured, widely-used. ## Caching **hot** () In-memory caching library for Go with 9 eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, loaders with singleflight deduplication, sharding, and stale-while-revalidate. **Ristretto** () High-performance memory-bound Go cache. **BigCache** () Efficient key/value cache for gigabytes of data. Sharded, optimized for high throughput. **go-cache** () In-memory key-value store with expiration. Thread-safe, simple API. ## Rate Limiting **Tollbooth** () Rate limiting HTTP middleware. Simple, volume-based limiting, easy to use. **golang.org/x/time/rate** () Standard library rate limiter. Token bucket algorithm, well-maintained. ## Concurrency & Goroutines **Watermill** () Event-driven framework for Go. Message streams, event sourcing, CQRS patterns. **ro** () Reactive programming for Go. Event-driven streams with operators for data flow transformation. ## Messaging **franz-go** () Kafka client for Go. Modern, high-performance, feature-complete client with excellent documentation and community support. **amqp091-go** () Official RabbitMQ client for Go. Maintained by RabbitMQ team, supports AMQP 0.9.1 protocol. **NATS.go** () Client for NATS messaging system. Simple, secure, performant communications. **Temporal Go SDK** () Durable execution framework for building reliable async applications. Workflows, activities, and long-running processes. **DBOS** () Backend framework for Go applications with durable execution, built on PostgreSQL. ## Types and Data Structures **gods** () Go Data Structures - Sets, Lists, Stacks, Maps, Trees, Queues, and much more **bloom** () Bloom filter implementation. Memory-efficient set membership testing. **hyperloglog** () HyperLogLog implementation for Go. Memory-efficient cardinality estimation for large datasets. **Carbon** () Simple, semantic time library for Go. Time parsing, formatting, manipulation. **google/uuid** () Generate and parse UUIDs. Official Google library, RFC 4122 compliant. ## Database Schema Migration **golang-migrate** () Database migration tool. Supports multiple databases, version control for schemas. **goose** () Database migration tool. SQL or Go migrations, supports multiple databases. ## WebSockets **gorilla/websocket** () WebSocket package for Go. Mature, widely-used, part of Gorilla toolkit. ## gRPC **grpc-go** () The Go language implementation of gRPC. HTTP/2 based RPC framework by Google. ## GraphQL **gqlgen** () Go generate based graphql server library. Type-safe, schema-first, code generation. **graphql-go** () Implementation of GraphQL for Go. Query execution, schema parsing. ## File Watching **fsnotify** () Cross-platform file system watcher for Go. Watch for file changes efficiently. ## Retry Logic **avast/retry-go** () Retry mechanism for Go with exponential backoff. Simple, configurable. ## Error Handling **pkg/errors** () Legacy projects only. Prefer stdlib `errors`, `fmt.Errorf("%w")`, and `errors.Join` for new code; use a structured error library only when you need stack traces or rich context. **oops** () Error handling library with stack traces, hints, and context. Rich error wrapping with type-safe error chains. ## Metrics & Monitoring **prometheus/client_golang** () Prometheus instrumentation library for Go. Metrics, histograms, counters, gauges. **opentelemetry-go** () OpenTelemetry Go API and SDK. Distributed tracing, metrics, logs. ## API Documentation **swag** () Auto-generate OpenAPI/Swagger specs from Go code annotations. Parses comment-based annotations (`@Summary`, `@Param`, `@Success`, `@Router`, etc.) on handler functions to produce `swagger.json`/`swagger.yaml`. Integrates with Gin (`gin-swagger`), Echo (`echo-swagger`), Fiber (`fiber-swagger`), Chi, and net/http. Supports Swagger 2.0 and OpenAPI 3.x output. ## Dependency Injection **do** () Dependency injection library for Go. Simple, runtime DI with service locator pattern and health checks. **Wire** () Code-generated dependency injection for Go. Compile-time dependency injection without reflection. **Dig** () Dependency injection container for Go. Runtime DI with lifecycle management. **Fx** () Application framework for Go. Built on Dig, provides lifecycle management, dependency injection, and observability. ## Functional Programming & Utilities **lo** () A generics-based helper library for Go. Slice, map, and tuple operations with functional programming style. **mo** () Monads and functional programming helpers for Go. Option, Either, Try, and other functional patterns. ## Excel & Spreadsheet **Excelize** () Go library for reading and writing Excel files (XLSX). Supports formatting, charts, and complex spreadsheet operations.