I’ve worked with Go for years, building web apps, CLIs, microservices, daemons, and all the in-between stuff nobody talks about. If you’ve worked with Go long enough, you know the standard library is solid, but you also know it’s not always enough.
Most problems you’ll run into have already been solved—cleanly, efficiently, and without the nonsense—by libraries maintained by people who know what they’re doing.
So instead of throwing out a list of “cool” Go packages, here’s a hand-picked set of 15 libraries that are actually worth using, based on real-world experience. These are things I’ve reached for again and again, and they’ve never let me down.
Core Utilities
If you’re building anything that touches config, flags, or maps—or you just want cleaner, testable code,these are the packages that’ll help you get it done.
1. spf13/cobra
The Cobra package is designed for building modern CLI applications. It supports subcommands, nested flag sets, command aliases, and generates help text automatically. It’s especially useful for CLI tools with multiple commands and a deeper structure.
Cobra integrates well with spf13/viper
for managing configuration and environment variables, which makes it ideal for full-featured command-line applications.
2. urfave/cli
This is a lighter-weight alternative to Cobra. It focuses on the fast development of command-line apps without requiring much setup. It supports flags, nested commands, and custom help messages, but does so with a smaller surface area.
urfave/cli is well-suited for internal tools or smaller utilities where you want fast iteration without a large framework.
3. stretchr/testify
testify is a testing toolkit that adds better assertions, mock capabilities, and test suite support on top of Go’s built-in testing package. It’s commonly used for simplifying test logic and improving test readability.
It doesn’t replace Go’s testing.T
, but works alongside it, giving you utilities like assert.Equal
, require.NoError
, and mock.Call
.
4. mitchellh/mapstructure
The mitchellh/mapstructure package helps decode map[string]interface{}
values, such as those returned by json.Unmarshal
or config files, into typed Go structs. It supports custom tags, weakly typed inputs, and embedded structs.
It’s especially helpful when working with dynamic inputs, such as user-defined configurations or external API data. You’ll often see it used in tools like Terraform or Consul.
Unlike encoding/json
, this focuses purely on map decoding, not marshaling/unmarshaling structured JSON.
5. olekukonko/tablewriter
tablewriter helps you render formatted tables in the terminal. It takes slices or arrays and prints them as aligned, readable tables, with support for borders, color, and alignment.
This is a great fit for CLI tools that require displaying lists, metrics, or tabular data. The package doesn’t deal with interactive UIs (like tview
does), but it handles static output well.
Web & APIs
If you’re building APIs, HTTP services, or JSON endpoints, these libraries improve routing, performance, and readability without locking you into rigid frameworks.
6. gin-gonic/gin
Gin is a high-performance HTTP web framework. It wraps Go’s standard net/http
package and adds routing, middleware support, JSON validation, and error handling.
It’s known for its speed and simplicity. If you’re building RESTful APIs and want something faster and more ergonomic than raw net/http
, Gin is a strong option.
7. labstack/echo
Echo is a full-featured web framework for Go. Like Gin, it offers routing and middleware, but it also includes built-in support for CORS, GZIP, JWT middleware, request validation, and more.
Echo is best when you want more “batteries included” functionality and are building something that benefits from built-in helpers (e.g., API versioning, structured error handlers).
While Gin and Echo overlap in purpose, Echo includes more out-of-the-box capabilities for production APIs.
8. go-chi/chi
Chi is a lightweight router that focuses on composability and idiomatic Go. It’s built around net/http
and designed to be modular and minimal.
Chi is ideal if you want full control over your stack without adopting a full framework. It integrates well with standard middleware patterns and is often used in microservice setups.
Unlike Gin and Echo, Chi avoids introducing new abstractions around handlers or context. If you like the standard library but want better routing, Chi is a great pick.
9. tidwall/gjson
GJSON allows you to extract values from JSON strings using a simple path syntax like user.name
, items.#.id
, etc., without unmarshalling into structs.
It’s incredibly fast and useful in cases where you’re inspecting or filtering raw JSON logs, responses, or configs. This is a read-only tool; if you want to modify JSON, check out sjson
from the same author.
Dev & Ops Helpers
These packages aren’t about features—they’re about keeping your codebase sane, your logs readable, and your CI clean. They’re the ones that make maintenance easier over time.
10. golangci/golangci-lint
The golangci-lint tool aggregates dozens of popular Go linters (like govet
, staticcheck
, errcheck
, etc.) into a single, fast binary. It’s configurable, fast, and widely used in continuous integration (CI) pipelines.
Instead of manually juggling multiple linters, golangci-lint
provides a unified interface to catch real issues early.
11. sirupsen/logrus
Logrus is a structured logger for Go that outputs in JSON, text, or custom formats. It’s simple to use and integrates easily with most projects.
While it’s not the fastest logger around, it’s stable, well-documented, and good for most apps that aren’t logging at extreme scale.
12. uber-go/zap
Zap is a structured logger built for speed. It avoids reflection and allocates far less than most logging packages.
If you’re working on high-throughput systems, background workers, or want better performance under load, Zap is a better choice than Logrus. Its API is more verbose, but the tradeoff is worth it for larger systems.
Storage, Persistence, and Data
If you’re storing state, caching data, or working with local files, these packages help avoid unnecessary complexity or external dependencies.
13. jmoiron/sqlx
sqlx builds on Go’s database/sql
and adds useful features like named queries, struct mapping, and scanning slices.
It doesn’t try to be an ORM—it just smooths out some of the rough edges. Perfect for apps that interact directly with SQL and want less boilerplate.
14. etcd-io/bbolt
Bolt, now maintained by etcd-io
, is a low-level, embedded key-value store. It’s ACID-compliant, fast, and doesn’t require a server process.
It’s a solid choice for storing user preferences, cached data, or small records locally. If you need a lightweight persistence layer without a full DB engine, Bolt is a great fit.
15. go-yaml/yaml
The go-yaml/yaml is the most reliable YAML parser for Go. It supports the full YAML spec (including anchors and aliases) and handles real-world files used in infra tools.
You’ll often run into YAML if you work with Kubernetes, Docker Compose, or Terraform. This package helps you load and parse them properly without surprises.
Concusion
These 15 packages are ones I’ve used repeatedly across real projects, and I keep coming back to them for a reason. They’re maintained, documented, and solve problems without getting in your way.
If you’ve got a favorite package I didn’t list—especially niche tools—drop a comment. Always happy to find sharp tools.