Skip to content

funcSearch()[]Result

Search across every article by title, description, tag, or category. You can also press ⌘K anywhere.

39 articles

Go

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.

7 min
Go

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.

6 min
Go

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.

6 min
Go

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.

6 min
Go

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.

6 min
Go

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.

5 min
Go

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.

7 min
Go

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.

8 min
Go

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.

10 min
Architecture

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.

16 min
PostgreSQL

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.

13 min
Go

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.

13 min
PostgreSQL

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.

13 min
Cloud

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.

13 min
Security

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.

14 min
Microservices

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.

12 min
Distributed Systems

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.

12 min
Microservices

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.

13 min
Distributed Systems

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.

13 min
Performance

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.

13 min
Microservices

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.

12 min
Go

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.

12 min
Microservices

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.

13 min
Backend

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.

12 min
Microservices

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.

11 min
Backend

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.

12 min
Backend

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.

12 min
PostgreSQL

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.

11 min
Backend

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.

13 min
Testing

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.

11 min
Performance

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.

10 min
Microservices

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.

10 min
Microservices

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.

10 min
PostgreSQL

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.

11 min
PostgreSQL

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.

11 min
Backend

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.

12 min
Go

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.

9 min
Go

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.

9 min
Go

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.

10 min