Sean's Blog

Go

July 7, 2026
Edit on GitHub

Go is a statically typed, compiled programming language with built-in garbage collection, designed at Google for simple, reliable, and efficient software. It often compiles to a single, easy-to-deploy binary and builds quickly, which makes it a natural fit for command line tools and cloud infrastructure. Docker, Kubernetes, and Terraform are all written in Go.

Go's biggest strength is its standard library and fast compilation times. The stdlib-first culture means you reach for net/http, testing, and log/slog before any third-party package. Concurrency is built into the language through goroutines and channels, influenced by Communicating Sequential Processes. This makes lightweight concurrent work easy to express, though it is not inherently simpler than Erlang’s actor model; Erlang emphasizes isolated processes that communicate by message passing, while Go combines message passing with shared-memory concurrency. Compared with Rust’s ownership-based approach, Go generally has a lower upfront learning curve but fewer compile-time guarantees.

The main downsides are verbosity, error handling, and limited type-system expressiveness. The repeated if err != nil pattern is noisy. There are no algebraic data types, nil still needs care, data races are possible at runtime, and generics exist since Go 1.18 but remain intentionally limited compared with Rust or TypeScript. Go modules work fine, but lack the smooth experience of Cargo.

Choose Go when you want simple deployment, fast builds, strong standard-library defaults, and readable service code. It is weaker when your domain needs highly expressive types, deep compile-time invariants, or sophisticated fault-tolerant concurrency abstractions.

Great introduction: https://go.dev/tour/

HTTP Server

Default to net/http. Since Go 1.22, the standard ServeMux supports method matching and wildcard path patterns, which covers many small and medium APIs without a framework.

  • chi: thin, idiomatic router that stays compatible with net/http middleware
  • Gin: popular, fast, established framework with more batteries included
  • Echo: well-documented framework with a clean API
  • Fiber: Express-inspired and fast, but built on fasthttp rather than net/http

CLI

  • cobra: the standard for CLI apps with subcommands, flags, and auto-help (used by kubectl and helm)
  • urfave/cli: simple and easy to learn for small CLI tools

TUI

  • bubbletea: modern TUI framework for interactive terminal apps

Desktop GUI

  • Wails: Go backend with a web frontend (like Tauri for Rust) to build desktop apps
  • Fyne: pure Go, native cross-platform GUI toolkit

Database

  • database/sql: generic stdlib interface around SQL drivers
  • pgx: first-class Postgres driver and toolkit
  • sqlc: generates type-safe Go code from hand-written SQL
  • sqlx: quality-of-life layer on top of database/sql
  • ent: schema-first code generator that maps graph schemas to Go types

Machine Learning

Go is not the best ecosystem for model training or research. Use it mostly for numeric utilities, data processing, and deploying exported models inside Go services. There is no mature drop-in equivalent to NumPy's ndarray ecosystem.

  • gonum: third-party numerical computing stack and closest Go analogue to NumPy/SciPy for linear algebra, statistics, probability, optimization, integration, and graphs
  • gonum/mat: NumPy-like dense matrices and linear algebra
  • gonum/stat: statistics helpers for distributions, regression, distances, and summary statistics
  • gonum/optimize: SciPy-like numerical optimization
  • GoMLX: active ML framework with tensors and accelerator-backed computation; closer to PyTorch/JAX than NumPy
  • onnxruntime_go: Go wrapper around ONNX Runtime for running exported neural networks; requires the ONNX Runtime shared library

Logging

  • log/slog: structured logging in the standard library since Go 1.21
  • zap: high-performance structured logging
  • zerolog: zero-allocation JSON logger

Testing

  • testing: the built-in package for unit tests, benchmarks, and fuzzing
  • testify: extends stdlib testing with clean assertions and mocks
  • gomock: maintained mocking framework for interfaces and external services

Linting

Concurrency

  • sync: stdlib primitives (Mutex, WaitGroup, Once, Map)
  • errgroup: run goroutines as a group and cancel on first error
  • ergo: Erlang/OTP-inspired actor framework for distributed systems
  • hollywood: actor framework for building concurrent Go applications
  • protoactor-go: actor model framework with local and distributed actors

References

#coding