funcSearch()[]Result
Search across every article by title, description, tag, or category. You can also press ⌘K anywhere.
39 articles
Defer, Panic, and Recover in Go
How defer actually schedules a call, what panic does to the call stack, why recover only works inside a deferred function, and the real-world pattern of recovering from panics in HTTP middleware — with diagrams.
Error Handling in Go: Custom Errors, Wrapping, and errors.Is/As
Why Go treats errors as ordinary values instead of exceptions, how to build custom error types, how wrapping with %w preserves the original cause, and how errors.Is and errors.As actually work — with diagrams.
Go Modules and Packages: Setting Up and Structuring a Go Project
What a Go module actually is, how go.mod and go.sum work, how packages and import paths map to directories, and how to structure a project before you write your first real program.
Pointers in Go: When to Use *T and Why
What a pointer actually is, why Go passes everything by value by default, and the concrete rule for when a function or method should take a pointer instead of a copy — with diagrams.
Slices, Arrays, and Maps in Go: How They Actually Work
Why a slice is a small header pointing at a backing array, what append actually does when it grows, why slicing can alias memory you didn't mean to share, and how Go's maps behave — with diagrams.
Structs, Methods, and Composition in Go
How to define your own types with structs, attach behavior with methods, and build up functionality through embedding instead of inheritance — with diagrams and real examples.
sync.WaitGroup, sync.Mutex, and the Race Detector in Go
How to wait for a group of goroutines to finish with WaitGroup, protect shared state with Mutex when a channel is overkill, and catch data races before they reach production with go test -race — with diagrams.
Understanding HTTP Servers in Go: From TCP Listen to Your First Handler
What actually happens when you call http.ListenAndServe: TCP listen and accept, the goroutine-per-connection model, the Handler interface, routing, and the timeouts a real server needs — with diagrams and a runnable example.
Goroutines and Channels in Go: A Fresher-Friendly Guide
A beginner's guide to Go concurrency: what a goroutine actually is, every channel type (unbuffered, buffered, directional), select, and a worker pool example that ties it all together — with diagrams.
Designing a Production-Ready Go Backend: Architecture, Reliability and Operations
How the pieces of a production Go backend fit together: application architecture, reliability patterns, data, messaging, security, observability, and deployment — plus when to choose a monolith, modular monolith, or microservices.
Scaling PostgreSQL for Go Applications: Read Replicas, Connection Pools and Query Performance
A practical order of operations for scaling PostgreSQL under a growing Go service: query optimization first, then pooling, then read replicas — and why the order matters.
Advanced Go Concurrency: Worker Pools, Backpressure and Bounded Concurrency
Why unbounded goroutines don't scale: semaphore-based bounded concurrency, backpressure, errgroup, goroutine leaks, and a real benchmark comparing the two.
Database Transactions in Go: Isolation Levels, Locks and Real-World Failures
PostgreSQL transaction isolation levels in Go, explained through a real race condition: lost updates, SELECT FOR UPDATE, and why app-level locking isn't enough.
Kubernetes for Go Developers: Deploying a Production-Ready Go API
What actually happens when Kubernetes sends your Go process SIGTERM, and the Deployment, Service, probe, and resource config a production Go API needs.
Securing Go REST APIs: Authentication, Authorization and Common Attack Surfaces
Practical Go API security: authentication vs authorization, JWT and refresh tokens, object-level authorization, SQL injection, CORS, and a production checklist.
Circuit Breakers in Go: Preventing Cascading Failures
Implementing a circuit breaker in Go to stop cascading failures — closed/open/half-open states, and why combining it with retries incorrectly makes things worse.
Idempotent Consumers in Go: Handling Duplicate Messages Safely
Why message consumers must assume duplicate delivery, and how to implement deduplication in Go and PostgreSQL without a race condition.
Event-Driven Architecture with Go: Events, Consumers and Failure Handling
Designing event-driven Go services: commands vs events, consumer groups, ordering, and why every consumer must handle duplicate delivery.
Distributed Locks in Go: Redis, PostgreSQL and the Problems You Need to Understand
Implementing distributed locks in Go with Redis and PostgreSQL advisory locks — lock ownership, TTLs, fencing tokens, and why a naive SET-based lock is unsafe.
Load Testing a Go API: Finding the Real Bottleneck
Load testing a Go API with k6: throughput, p50/p95/p99 latency, and a systematic way to find whether the bottleneck is the app, the database, or the network.
Observability for Go Microservices: Logs, Metrics and Traces
The three pillars of observability for Go microservices — structured logs, Prometheus metrics, and distributed traces — and how they differ from monitoring.
Building Background Workers in Go with Goroutines and Channels
A production-oriented worker pool in Go: bounded concurrency, graceful shutdown, panic recovery, and why 'go process(job) for every job' is dangerous.
The Outbox Pattern with Go and PostgreSQL
Solving the dual-write problem between PostgreSQL and a message broker with the transactional outbox pattern, implemented in Go.
Idempotency in APIs: Preventing Duplicate Payments and Requests
Implementing idempotency keys in Go and PostgreSQL to prevent duplicate payments and orders when clients retry after a timeout.
Retries, Timeouts and Backoff in Go: Building Resilient Services
A practical HTTP client with timeouts, exponential backoff, and jitter — and why retries should never be applied blindly to every request.
Caching in Go: Redis, Cache-Aside and Cache Invalidation
A practical cache-aside implementation in Go with Redis: TTLs, cache stampedes, invalidation strategies, and when caching is the wrong call.
API Rate Limiting in Go: Token Bucket, Middleware and Distributed Limits
Rate limiting a Go API in practice: token bucket vs sliding window, an in-memory middleware implementation, and why it breaks across multiple replicas.
PostgreSQL Connection Pooling in Go: pgxpool Explained
How pgxpool connection pooling actually works in Go: MaxConns, MinConns, connection lifetimes, pool exhaustion, and why raising MaxConns isn't always the fix.
Building a Go API with Clean Architecture Without Overengineering
A practical take on Clean Architecture in Go: handler/service/repository separation, dependency direction, and knowing when to stop adding abstractions.
Testing Go Backend Applications: Unit, Integration and HTTP Tests
A practical testing strategy for Go backend services: table-driven unit tests, httptest for handlers, mocks for services, and integration tests against a real PostgreSQL database.
Profiling Go Applications with pprof
Profile CPU, memory, and goroutines in a running Go HTTP service with net/http/pprof, and learn to read the profiles to find real performance problems.
REST vs gRPC for Go Microservices
A practical comparison of REST/JSON and gRPC for Go microservices, with a decision matrix covering performance, streaming, debugging, and browser compatibility.
Go Microservices: A Practical Project Structure
A practical, minimal project structure for Go microservices: service boundaries, internal packages, configuration, migrations, and Docker — without over-engineering.
EXPLAIN ANALYZE in PostgreSQL: How to Find Slow Queries
How to read PostgreSQL EXPLAIN ANALYZE output to diagnose slow queries: sequential vs index vs bitmap scans, join strategies, row estimates, and buffers.
PostgreSQL Indexes: A Practical Guide for Backend Engineers
A practical guide to PostgreSQL indexing for backend engineers: B-tree, GIN, composite and partial indexes, selectivity, overhead, and when indexes hurt performance.
Building a Production-Ready REST API with Go
A clean, minimal-abstraction project structure for production Go REST APIs: routing, configuration, handlers, services, repositories, validation, error handling, logging, middleware, and health checks.
Graceful Shutdown in Go HTTP Servers
Implement graceful shutdown for Go HTTP servers: handling SIGTERM and SIGINT, draining active requests, shutdown timeouts, and Kubernetes readiness.
Go Interfaces: Design Small, Testable Components
Design small, focused Go interfaces for dependency injection, mocking, and testable backend code, with realistic service and repository examples.
Context in Go: Cancellation, Deadlines and Request Propagation
Understand Go's context.Context: cancellation, deadlines, timeouts and request-scoped propagation, with practical HTTP and database examples.