All posts
Go Practice #6 Testing and Deployment — httptest and Docker
Handler tests with httptest, integration test patterns, Docker multistage builds, and a small operations checklist.
Go Practice #5 Middleware Patterns
Standard middleware built from chains of http.Handler adapters — logging, auth, panic recovery, request ID, CORS.
Go Practice #4 DB Integration — database/sql and Transactions
database/sql basics, prepared statements, transactions, and connection pool tuning. Plus higher-level tools like sqlc, sqlx, and GORM.
Go Practice #3 JSON I/O and Input Validation
Marshal/Unmarshal in encoding/json, struct tags, decoding error handling, and patterns for safe input validation.
Go Practice #2 Routing — Go 1.22+ ServeMux
Method/pattern matching in the standard ServeMux from Go 1.22+. Where external routers like chi or gorilla/mux still fit.
Go Practice #1 First HTTP Server
The smallest server, started with the single net/http package. ListenAndServe, HandleFunc, ResponseWriter, and graceful shutdown.
Go Advanced #7 Code Generation — go generate and stringer
A path that avoids reflect's runtime cost — compile-time code generation. The go generate workflow, plus tools like stringer and mockgen.
Go Advanced #6 Profiling — pprof and benchmark
Measuring CPU, memory, and goroutine profiles with go test -bench and pprof. Addressing performance with measurement instead of guesswork.
Go Advanced #5 unsafe and cgo — Outside the Safe Zone
unsafe.Pointer's four rules, cgo's tradeoffs, and why both should almost never be used.
Go Advanced #4 reflect Package — Handling Types at Runtime
reflect.Type and reflect.Value, reading struct tags, dynamic calls. The tool you see inside serialization libraries.
Go Advanced #3 Generics — Type Parameters and Constraints
Generics in Go 1.18. Type-parameter syntax, constraints, comparable and the ~ token, and when not to use them.
Go Advanced #2 Memory Model and the sync Package
Mutex, RWMutex, WaitGroup, Once, atomic — shared-memory synchronization tools beyond channels. Which to use when.