thecodex.expert · The Codex Family of Knowledge
Go

Standard Library

A production HTTP server, a JSON API, and a test suite are all achievable using only the standard library — no dependencies to audit or update.

Go 1.26 Batteries included Last verified:
Canonical Definition

Go’s standard library is unusually comprehensive for a systems language: net/http gives a production-grade web server, encoding/json handles serialization, testing covers unit tests and benchmarks, and crypto/* covers hashing and TLS — all without a third-party dependency. This is a deliberate design choice that reduces the surface area of supply-chain risk and version-conflict headaches common in ecosystems that lean more heavily on external packages.

Everyday packages: fmt, strings, strconv

fmt handles formatted I/O (Println, Sprintf, Errorf); strings covers string manipulation (splitting, joining, searching); strconv converts between strings and other types — these three appear in nearly every non-trivial Go file.

Goeveryday.go
name := "  Gopher  "
trimmed := strings.TrimSpace(name)          // "Gopher"
parts := strings.Split("a,b,c", ",")        // ["a", "b", "c"]

n, err := strconv.Atoi("42")                // 42, converts string to int
s := strconv.Itoa(42)                        // "42", converts int to string

msg := fmt.Sprintf("Hello, %s! You are %d.", trimmed, n)

Collections and sorting: slices, maps, sort

Since Go 1.21, the generic slices and maps packages added common operations (slices.Sort, slices.Contains, maps.Keys) that previously required hand-written loops or the older, non-generic sort package interfaces.

Gocollections.go
nums := []int{5, 2, 8, 1}
slices.Sort(nums)                     // [1, 2, 5, 8], in place
fmt.Println(slices.Contains(nums, 8)) // true

Time, networking, and cryptography

time handles durations, timestamps, and timers; net and net/http cover raw sockets up through full HTTP servers; crypto/sha256, crypto/tls, and related packages provide hashing and secure connections — all standard-issue, all without adding a dependency to go.mod.

Sources

1
The Go Authors. Standard library package index, pkg.go.dev/std.