The Go Developer's Toolbox — Essential Tools & Libraries
A field guide to the most widely used command-line tools and libraries in the Go ecosystem.
A comprehensive, opinionated field guide to the most widely used command-line tools and libraries in the Go ecosystem — what they are, why they exist, how to install them, and how to actually use them in a real project.
Table of Contents
- How to read this guide
- Part 1 — CLI / Development Tools
- Part 2 — Libraries
- Suggested “starter kit” per project type
How to read this guide
Each entry follows the same structure:
- What it is — one-line purpose
- Why it’s popular — the problem it solves
- Install — the
go installorgo getcommand - Usage — a realistic snippet or CLI invocation
- Notes — gotchas, alternatives, when not to use it
Most CLI tools below should be installed as dev tools, not as project dependencies. The idiomatic modern approach (Go 1.24+) is a dedicated tools.go/tools directory or, better, a go.mod tool directive (go get -tool) so tool versions are pinned per-repository instead of relying on whatever is in a developer’s $GOPATH/bin.
# Modern (Go 1.24+) way to pin a dev tool per-module
go get -tool github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go tool golangci-lint run
Part 1 — CLI / Development Tools
Build, Run & Live Reload
air — Live reload for Go apps
- Repo:
github.com/air-verse/air - What it is: A file-watcher that rebuilds and restarts your Go binary automatically whenever source files change — the Go equivalent of
nodemon. - Why it’s popular: Go compiles fast, but manually re-running
go runafter every edit during API/backend development is tedious.aircloses that feedback loop. - Install:
go install github.com/air-verse/air@latest - Usage:
Minimalair init # generates .air.toml air # watches, rebuilds, restarts.air.toml:[build] cmd = "go build -o ./tmp/main ./cmd/api" bin = "./tmp/main" include_ext = ["go", "tpl", "tmpl", "html"] exclude_dir = ["tmp", "vendor"] - Notes: Alternatives:
wgo,reflex,CompileDaemon.airremains the de facto standard for Go web dev.
task — Task runner / Makefile alternative
- Repo:
github.com/go-task/task/v3/cmd/task - What it is: A YAML-based task runner (
Taskfile.yml), positioned as a simpler, cross-platform alternative tomake. - Why it’s popular:
makesyntax (tabs,.PHONY, shell quirks) is unfriendly and non-portable to Windows. Task is declarative, has variables, includes, dependency graphs, and checksums to skip up-to-date tasks. - Install:
go install github.com/go-task/task/v3/cmd/task@latest - Usage:
# Taskfile.yml version: '3' tasks: build: cmds: - go build -o bin/app ./cmd/app test: cmds: - go test ./... -race -cover lint: cmds: - golangci-lint run ./... run: deps: [build] cmds: - ./bin/apptask build task test - Notes: Competing tools: plain
Makefile,mage(tasks written in Go itself),just.
Code Quality: Linting, Formatting & Static Analysis
golangci-lint — The linter aggregator
- Repo:
github.com/golangci/golangci-lint/cmd/golangci-lint - What it is: A meta-linter that runs 50+ individual linters (
govet,staticcheck,errcheck,unused,gosimple,revive, etc.) in parallel with caching. - Why it’s popular: It is the standard for CI pipelines — one config file, one command, fast, and highly configurable per-linter.
- Install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - Usage:
golangci-lint run ./... golangci-lint run --fix.golangci.yml:linters: enable: - govet - staticcheck - errcheck - gofmt - goimports - revive - gosec issues: exclude-dirs: - vendor - Notes: Almost every serious Go repo has this wired into CI and pre-commit hooks.
staticcheck — Deep static analysis
- Repo:
honnef.co/go/tools/cmd/staticcheck - What it is: An advanced static analyzer catching bugs, performance issues, and style problems that
go vetmisses (e.g., ineffective assignments, deprecated API use, redundant type conversions). - Why it’s popular: Considered one of the highest-signal, lowest-noise linters available; included by default inside
golangci-lint, but also runnable standalone. - Install:
go install honnef.co/go/tools/cmd/staticcheck@latest - Usage:
staticcheck ./...
goimports — Formatting + import management
- Repo:
golang.org/x/tools/cmd/goimports - What it is: A superset of
gofmtthat also adds/removes import statements automatically and groups them. - Why it’s popular: Nobody wants to manually manage
import ( ... )blocks; editors (VS Code, GoLand) run this on save. - Install:
go install golang.org/x/tools/cmd/goimports@latest - Usage:
goimports -w . - Notes:
gofumpt(mvdan.cc/gofumpt) is a stricter superset many teams prefer for enforcing extra formatting rules beyondgofmt.
Testing Tools
gotestsum — Human-friendly test output
- Repo:
gotest.tools/gotestsum - What it is: A wrapper around
go testthat produces readable, colorized summaries and JUnit XML for CI dashboards. - Why it’s popular: Raw
go test -voutput on large test suites is a wall of text.gotestsumgives a clean pass/fail tree and integrates with CI test reporters (GitHub Actions, GitLab, Jenkins). - Install:
go install gotest.tools/gotestsum@latest - Usage:
gotestsum --format testname ./... gotestsum --junitfile unit-tests.xml -- ./... -race -cover
ginkgo / gomega (honorable mention)
- What it is: A BDD-style testing framework (
Describe/It/Context) with a matching matcher library (gomega). - Why it’s popular: Used heavily in Kubernetes-ecosystem projects for expressive, spec-style tests.
- Install:
go install github.com/onsi/ginkgo/v2/ginkgo@latest go get github.com/onsi/gomega
Debugging & Profiling
delve (dlv) — The Go debugger
- Repo:
github.com/go-delve/delve/cmd/dlv - What it is: A source-level debugger built specifically for Go, understanding goroutines, channels, and the Go runtime — unlike generic
gdb. - Why it’s popular: It’s the debugger every Go IDE (VS Code’s Go extension, GoLand) drives under the hood. Essential for breakpoint debugging and post-mortem analysis.
- Install:
go install github.com/go-delve/delve/cmd/dlv@latest - Usage:
Inside the dlv REPL:dlv debug ./cmd/api # compile + debug dlv attach <pid> # attach to running process dlv test ./pkg/foo # debug a test(dlv) break main.go:42 (dlv) continue (dlv) print myVar (dlv) goroutines - Notes: For production/remote debugging,
dlv --headless --listen=:2345exposes a debug server your IDE can attach to.
pprof — Profiling (built into the standard library)
- What it is: Not a separate install —
net/http/pprofandgo tool pprofship with Go itself, for CPU, memory, goroutine, and block profiling. - Usage:
import _ "net/http/pprof" // then: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30go tool pprof -http=:8081 cpu.prof - Notes:
benchstat(golang.org/x/perf/cmd/benchstat) statistically comparesgo test -benchresults across runs — indispensable for verifying a perf optimization is real and not noise.
Database & Migration Tools
goose — Database migrations
- Repo:
github.com/pressly/goose/v3/cmd/goose - What it is: A SQL/Go-based schema migration tool supporting Postgres, MySQL, SQLite, and more, with plain up/down SQL files.
- Why it’s popular: Simple, explicit, no ORM lock-in; migrations are just versioned
.sqlfiles (or Go functions for complex data migrations). - Install:
go install github.com/pressly/goose/v3/cmd/goose@latest - Usage:
goose create add_users_table sql goose -dir ./migrations postgres "$DATABASE_URL" up goose -dir ./migrations postgres "$DATABASE_URL" status - Notes: Main competitor is
golang-migrate/migrate, which has a broader set of database drivers and can be used as a library, not just a CLI.
sqlc — Generate type-safe Go from SQL
- Repo:
github.com/sqlc-dev/sqlc/cmd/sqlc - What it is: Reads your
.sqlschema + queries and generates fully-typed Go structs and query functions — no ORM, no reflection, no runtime magic. - Why it’s popular: Gives you compile-time safety on raw SQL, with zero abstraction overhead — extremely popular as a
gormalternative among teams that prefer SQL-first workflows. - Install:
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest - Usage:
sqlc.yaml:version: "2" sql: - engine: "postgresql" queries: "queries.sql" schema: "schema.sql" gen: go: package: "db" out: "internal/db"sqlc generate
generates a Go function-- name: GetUserByID :one SELECT * FROM users WHERE id = $1;func (q *Queries) GetUserByID(ctx context.Context, id int64) (User, error).
Code Generation (API, GraphQL, SQL, Mocks)
oapi-codegen — OpenAPI → Go
- Repo:
github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen - What it is: Generates Go server stubs, client SDKs, and type definitions directly from an OpenAPI (Swagger) 3.0 spec.
- Why it’s popular: Keeps your API contract and Go types in sync; supports
chi,echo,gin,net/http, and strict-server modes. - Install:
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest - Usage:
oapi-codegen -generate types,chi-server -package api openapi.yaml > api/server.gen.go - Notes: For the reverse direction (Go → OpenAPI),
swaggo/swaggenerates docs from code annotations.
gqlgen — GraphQL server generator
- Repo:
github.com/99designs/gqlgen - What it is: A schema-first GraphQL server generator: you write a
.graphqlSDL schema, and it generates resolvers, models, and the executable schema. - Why it’s popular: The most mature, actively maintained, and type-safe GraphQL library in Go — avoids the reflection-heavy, less-typed approach of older libraries.
- Install:
go install github.com/99designs/gqlgen@latest - Usage:
You then implement the generatedgo run github.com/99designs/gqlgen init go run github.com/99designs/gqlgen generateResolverinterface with your business logic.
buf — Protobuf tooling
- Repo:
github.com/bufbuild/buf/cmd/buf - What it is: A modern replacement for the raw
protocCLI: linting, breaking-change detection, dependency management (BSR — Buf Schema Registry), and faster codegen for.protofiles. - Why it’s popular:
protocalone has painful dependency/import management;buffixes that with abuf.yaml/buf.gen.yamlworkflow and is now the standard in gRPC-heavy Go shops. - Install:
go install github.com/bufbuild/buf/cmd/buf@latest - Usage:
buf lint buf breaking --against '.git#branch=main' buf generate
mockery — Mock generation for interfaces
- Repo:
github.com/vektra/mockery/v2 - What it is: Scans your Go interfaces and auto-generates
testify-compatible mock implementations. - Why it’s popular: Hand-writing mocks is tedious and error-prone;
mockerykeeps mocks in sync with interface changes automatically via a config file orgo generatedirectives. - Install:
go install github.com/vektra/mockery/v2@latest - Usage:
# .mockery.yaml with-expecter: true packages: myapp/internal/repo: interfaces: UserRepository:mockery//go:generate mockery --name=UserRepository - Notes: The standard-library alternative is
go.uber.org/mock(successor togolang/mock, now deprecated).
Task Runners & Git Hooks
lefthook — Fast Git hooks manager
- Repo:
github.com/evilmartians/lefthook/v2 - What it is: A single fast binary (written in Go) that manages Git hooks (
pre-commit,pre-push,commit-msg) via a simple YAML config, running checks in parallel. - Why it’s popular: Language-agnostic, much faster than shell-script-based hook managers or Husky (Node-based), and trivial to add to any repo (Go, JS, Python, monorepos).
- Install:
go install github.com/evilmartians/lefthook/v2@latest - Usage:
lefthook.yml:pre-commit: parallel: true commands: lint: glob: "*.go" run: golangci-lint run {staged_files} format: glob: "*.go" run: gofmt -l {staged_files}lefthook install
Security & Vulnerability Scanning
govulncheck — Official Go vulnerability scanner
- Repo:
golang.org/x/vuln/cmd/govulncheck - What it is: The Go team’s own tool that cross-references your dependency graph (and even call graph, not just imports) against the Go vulnerability database.
- Why it’s popular: Low false-positive rate because it checks whether vulnerable code paths are actually reachable, not just whether a vulnerable package is imported. Increasingly required in CI/CD and SOC2/supply-chain audits.
- Install:
go install golang.org/x/vuln/cmd/govulncheck@latest - Usage:
govulncheck ./... - Notes:
gosec(github.com/securego/gosec) complements it by scanning for insecure coding patterns (SQL injection, hardcoded credentials, weak crypto) rather than known CVEs.
Release & Packaging
goreleaser — Automated release pipeline
- Repo:
github.com/goreleaser/goreleaser - What it is: Builds cross-platform binaries, generates changelogs, creates GitHub/GitLab releases, builds Docker images, and publishes to package managers (Homebrew, Scoop, apt) — all from one YAML config.
- Why it’s popular: It’s the de facto standard for shipping Go CLIs; almost every popular open-source Go CLI tool (
k9s,hugo,gh) uses it. - Install:
go install github.com/goreleaser/goreleaser/v2@latest - Usage:
goreleaser init goreleaser release --clean goreleaser release --snapshot --clean # local dry-run
Part 2 — Libraries
Validation
go-playground/validator
- Repo:
github.com/go-playground/validator - What it is: The most widely used struct-tag-based validation library in Go.
- Why it’s popular: Declarative validation via struct tags (
validate:"required,email"), deeply integrated withginandechofor request-body validation, supports custom validators and cross-field rules. - Install:
go get github.com/go-playground/validator/v10 - Usage:
type CreateUserRequest struct { Name string `validate:"required,min=2,max=50"` Email string `validate:"required,email"` Age int `validate:"gte=0,lte=130"` } validate := validator.New() if err := validate.Struct(req); err != nil { for _, e := range err.(validator.ValidationErrors) { fmt.Println(e.Field(), e.Tag()) } }
Testing & Assertions
stretchr/testify
- Repo:
github.com/stretchr/testify - What it is: The most-used assertion/mocking toolkit for Go’s built-in
testingpackage:assert,require,mock, andsuite. - Why it’s popular: Vanilla
if got != want { t.Errorf(...) }boilerplate is verbose; testify gives readable one-liners and rich diff output.testify/mockis also the interfacemockery-generated mocks target. - Install:
go get github.com/stretchr/testify - Usage:
func TestAdd(t *testing.T) { result := Add(2, 3) assert.Equal(t, 5, result, "they should be equal") require.NoError(t, err) // stops the test immediately on failure } type CalcSuite struct { suite.Suite } func (s *CalcSuite) TestAdd() { s.Equal(5, Add(2, 3)) } func TestCalcSuite(t *testing.T) { suite.Run(t, new(CalcSuite)) }
HTTP Routers & Web Frameworks
gin-gonic/gin
- Repo:
github.com/gin-gonic/gin - What it is: The most popular full-featured HTTP web framework in Go — routing, middleware, JSON binding/validation, rendering.
- Why it’s popular: Extremely fast (built on a radix tree router), huge middleware ecosystem, gentle learning curve, and the most GitHub stars of any Go web framework.
- Install:
go get github.com/gin-gonic/gin - Usage:
r := gin.Default() r.GET("/users/:id", func(c *gin.Context) { id := c.Param("id") c.JSON(200, gin.H{"id": id}) }) r.Run(":8080")
labstack/echo
- Repo:
github.com/labstack/echo/v4 - What it is: A minimalist, high-performance web framework — Gin’s closest competitor.
- Why it’s popular: Clean API, first-class middleware, built-in support for HTTP/2, WebSockets, and automatic TLS.
- Usage:
e := echo.New() e.GET("/users/:id", func(c echo.Context) error { return c.JSON(200, map[string]string{"id": c.Param("id")}) }) e.Start(":8080")
go-chi/chi
- Repo:
github.com/go-chi/chi/v5 - What it is: A lightweight router that is 100% compatible with
net/http’shttp.Handler— no framework “magic,” just composable middleware. - Why it’s popular: Preferred by teams who want idiomatic stdlib-compatible code without adopting a full framework; very popular for microservices.
- Usage:
r := chi.NewRouter() r.Use(middleware.Logger) r.Get("/users/{id}", getUserHandler) http.ListenAndServe(":8080", r) - Notes: Since Go 1.22,
net/http’s ownServeMuxgained method-based routing and wildcards, reducing the need for a router library in simple services — butchi’s middleware ecosystem still gives it an edge.
Configuration & CLI
spf13/cobra
- Repo:
github.com/spf13/cobra - What it is: The library for building CLI applications with subcommands, flags, and auto-generated help — used by
kubectl,hugo,gh,docker. - Install:
go get github.com/spf13/cobra - Usage:
var rootCmd = &cobra.Command{Use: "app", Short: "My CLI"} var greetCmd = &cobra.Command{ Use: "greet [name]", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Hello,", args[0]) }, } func main() { rootCmd.AddCommand(greetCmd) rootCmd.Execute() } - Notes:
spf13/cobra-cliis the companion generator (cobra-cli init,cobra-cli add).
spf13/viper
- Repo:
github.com/spf13/viper - What it is: Configuration management supporting JSON/YAML/TOML/env vars/flags/remote config (etcd/Consul), with automatic precedence and live-reload.
- Why it’s popular: Pairs naturally with
cobra; the default choice for “12-factor” style config loading. - Usage:
viper.SetConfigName("config") viper.AddConfigPath(".") viper.AutomaticEnv() viper.ReadInConfig() port := viper.GetInt("server.port") - Notes: Lighter alternatives many teams prefer for simplicity:
caarlos0/env(struct-tag based env parsing) orkelseyhightower/envconfig.
joho/godotenv
- Repo:
github.com/joho/godotenv - What it is: Loads
.envfiles into environment variables, mirroring Node’sdotenv. - Usage:
godotenv.Load() dbURL := os.Getenv("DATABASE_URL")
Logging
uber-go/zap
- Repo:
go.uber.org/zap - What it is: A structured, leveled logger optimized for near-zero allocation performance.
- Why it’s popular: Built by Uber for high-throughput services; benchmarks consistently show it as one of the fastest structured loggers in Go.
- Usage:
logger, _ := zap.NewProduction() defer logger.Sync() logger.Info("user created", zap.String("user_id", "123"), zap.Int("age", 30), )
rs/zerolog
- Repo:
github.com/rs/zerolog - What it is: A zero-allocation JSON structured logger with a chainable API.
- Why it’s popular: Often preferred over
zapfor its simpler, more ergonomic API while retaining comparable performance. - Usage:
log.Info().Str("user_id", "123").Int("age", 30).Msg("user created") - Notes: Since Go 1.21, the standard library’s
log/slogprovides structured logging out of the box and is increasingly used for simpler projects that don’t needzap/zerolog’s extra performance.
Database Access & ORM
jmoiron/sqlx
- Repo:
github.com/jmoiron/sqlx - What it is: A thin extension over
database/sqladding struct scanning, named queries, and convenience methods — without becoming a full ORM. - Why it’s popular: For teams that want raw SQL control but hate manual
rows.Scan(&a, &b, &c)boilerplate. - Usage:
var users []User db.Select(&users, "SELECT * FROM users WHERE active = $1", true)
go-gorm/gorm
- Repo:
gorm.io/gorm - What it is: The most popular full-featured ORM in Go — associations, migrations, hooks, transactions, eager loading.
- Why it’s popular: Fastest way to get CRUD + relations working without writing SQL; large plugin ecosystem (soft delete, sharding, tracing).
- Usage:
type User struct { gorm.Model Name string Age int } db.AutoMigrate(&User{}) db.Create(&User{Name: "Alice", Age: 30}) var users []User db.Where("age > ?", 18).Find(&users) - Notes: Many teams choose
sqlc+sqlx/pgxovergormfor performance-critical or SQL-first codebases, reservinggormfor CRUD-heavy admin panels/internal tools where developer velocity matters more.
jackc/pgx
- Repo:
github.com/jackc/pgx/v5 - What it is: A PostgreSQL driver and toolkit that is faster and more feature-complete than
lib/pq(which is now in maintenance mode), supporting the native Postgres protocol directly. - Usage:
conn, _ := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL")) var name string conn.QueryRow(context.Background(), "select name from users where id=$1", 1).Scan(&name)
Dependency Injection
google/wire
- Repo:
github.com/google/wire - What it is: A compile-time dependency injection code generator (not a runtime DI container/reflection-based framework).
- Why it’s popular: Generates plain, debuggable Go constructor code — no runtime reflection cost, no “magic” container, errors caught at build time.
- Usage:
func InitializeApp() (*App, error) { wire.Build(NewDB, NewUserRepo, NewUserService, NewApp) return nil, nil // replaced by generated code }go install github.com/google/wire/cmd/wire@latest wire ./...
gRPC & Protocol Buffers
grpc/grpc-go
- Repo:
google.golang.org/grpc - What it is: The official Go implementation of gRPC, the high-performance RPC framework built on HTTP/2 and Protobuf.
- Usage:
s := grpc.NewServer() pb.RegisterUserServiceServer(s, &userServer{}) lis, _ := net.Listen("tcp", ":50051") s.Serve(lis) - Notes: Typically paired with
buf(see Part 1) for schema management and codegen instead of rawprotoc.
google.golang.org/protobuf
- Repo:
google.golang.org/protobuf - What it is: The Go Protobuf runtime (API v2), successor to
golang/protobuf. - Usage: Typically not hand-written — generated by
protoc/buffrom.protofiles, then imported by generated*.pb.gocode.
Utilities & Generics
samber/lo
- Repo:
github.com/samber/lo - What it is: A Lodash-style generics utility library (
Map,Filter,Reduce,GroupBy,Uniq,Chunk, etc.) built on Go 1.18+ generics. - Why it’s popular: Fills the gap left by Go’s minimal
slices/mapsstdlib packages with a much richer, ergonomic API. - Usage:
evens := lo.Filter([]int{1, 2, 3, 4}, func(x int, _ int) bool { return x%2 == 0 }) doubled := lo.Map(evens, func(x int, _ int) int { return x * 2 })
golang.org/x/sync
- Repo:
golang.org/x/sync - What it is: Official extended concurrency primitives:
errgroup(goroutine groups with error propagation),singleflight(dedupe concurrent identical calls),semaphore. - Usage:
g, ctx := errgroup.WithContext(context.Background()) for _, url := range urls { url := url g.Go(func() error { return fetch(ctx, url) }) } if err := g.Wait(); err != nil { /* handle */ }
Errors, IDs, Time & Misc
google/uuid
- Repo:
github.com/google/uuid - What it is: The standard library for generating and parsing UUIDs (v1, v3, v4, v5, v6, v7).
- Usage:
id := uuid.New() parsed, err := uuid.Parse("550e8400-e29b-41d4-a716-446655440000")
pkg/errors (legacy) → standard errors + fmt.Errorf("%w")
- What it is:
pkg/errorspopularized error-wrapping with stack traces before Go 1.13 added native%wwrapping anderrors.Is/errors.As. It’s now largely superseded by the standard library, though still seen in older codebases. - Modern usage:
if err != nil { return fmt.Errorf("fetching user %d: %w", id, err) } if errors.Is(err, sql.ErrNoRows) { ... } - Notes: For rich stack-trace-capturing errors, teams now often reach for
go.uber.org/multierr(combining multiple errors) orcockroachdb/errors.
golang-jwt/jwt
- Repo:
github.com/golang-jwt/jwt/v5 - What it is: The standard library for creating/verifying JSON Web Tokens (successor to the archived
dgrijalva/jwt-go). - Usage:
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "user_id": 42, "exp": time.Now().Add(time.Hour).Unix(), }) signed, _ := token.SignedString([]byte("secret"))
robfig/cron
- Repo:
github.com/robfig/cron/v3 - What it is: A cron-expression-based job scheduler for in-process scheduled tasks.
- Usage:
c := cron.New() c.AddFunc("0 */1 * * *", func() { fmt.Println("runs hourly") }) c.Start()
Observability
prometheus/client_golang
- Repo:
github.com/prometheus/client_golang - What it is: The official Prometheus metrics client — counters, gauges, histograms, and an HTTP
/metricsendpoint exporter. - Usage:
var requests = promauto.NewCounter(prometheus.CounterOpts{ Name: "http_requests_total", }) http.Handle("/metrics", promhttp.Handler())
open-telemetry/opentelemetry-go
- Repo:
go.opentelemetry.io/otel - What it is: The vendor-neutral standard for distributed tracing, metrics, and logs instrumentation across services.
- Why it’s popular: Increasingly the default choice for microservice observability, replacing vendor-specific SDKs (Jaeger client, Datadog SDK) with a single instrumentation API.
Messaging, Caching & Background Jobs
redis/go-redis
- Repo:
github.com/redis/go-redis/v9 - What it is: The most popular Redis client for Go, supporting pipelines, pub/sub, cluster mode, and Redis-specific data structures.
- Usage:
rdb := redis.NewClient(&redis.Options{Addr: "localhost:6379"}) rdb.Set(ctx, "key", "value", time.Hour) val, _ := rdb.Get(ctx, "key").Result()
hibiken/asynq
- Repo:
github.com/hibiken/asynq - What it is: A Redis-backed distributed task queue for background job processing (similar to Sidekiq/Celery, but for Go).
- Usage:
client := asynq.NewClient(asynq.RedisClientOpt{Addr: "localhost:6379"}) task := asynq.NewTask("email:send", payload) client.Enqueue(task)
segmentio/kafka-go
- Repo:
github.com/segmentio/kafka-go - What it is: A pure-Go Kafka client (no cgo dependency on
librdkafka, unlikeconfluent-kafka-go). - Usage:
w := &kafka.Writer{Addr: kafka.TCP("localhost:9092"), Topic: "events"} w.WriteMessages(ctx, kafka.Message{Value: []byte("hello")})
Suggested “starter kit” per project type
| Project type | Recommended stack |
|---|---|
| REST API service | chi or gin + validator + zap/zerolog + sqlc or sqlx/pgx + goose + testify + golangci-lint + air |
| gRPC microservice | grpc-go + buf + opentelemetry-go + wire + sqlc |
| CLI tool | cobra + viper + goreleaser |
| GraphQL API | gqlgen + sqlc/gorm + validator |
| Background worker | asynq or kafka-go + zap + cron |
| Every repo, regardless of type | golangci-lint, staticcheck, govulncheck, goimports, gotestsum, lefthook, testify |
A note on keeping this list current
The Go tooling ecosystem moves quickly — go.mod tool directives, slog, and net/http’s routing improvements are recent examples of the standard library absorbing what used to require third-party packages. Periodically re-evaluate whether a dependency is still the best choice, or whether the standard library has caught up.