Mahib's Margins

Command Palette

Search for a command to run...

Recent writing

Longer articles, short notes, and things I'll probably need to look up again.

Browse the archive
  • October 6, 2024

    go
    Writing a circuit breaker in Go

    Build a production-ready circuit breaker in Go from scratch with closed, open, and half-open states to prevent cascading failures.

  • March 6, 2024

    go
    Dysfunctional options pattern in Go

    Discover a simpler alternative to functional options: method chaining with builder-style configuration that's 76x faster and easier to understand.

  • September 5, 2023

    go
    Configuring options in Go

    Compare three Go option patterns: exposed structs, option constructors, and functional options. Learn when to use each for clean APIs.

  • August 23, 2023

    go
    Limit goroutines with buffered channels

    Control goroutine concurrency with buffered channels as semaphores. Prevent resource exhaustion with backpressure patterns in Go workers.

  • August 18, 2023

    go
    Interface guards in Go

    Use compile-time interface guards to verify type conformity in Go without runtime overhead. Learn the var _ Interface = (*Type)(nil) pattern.

  • August 10, 2023

    go
    Go structured logging with slog

    Master Go 1.21's log/slog package for structured logging with levels, JSON output, and attribute grouping. No third-party libraries needed.