Mahib's Margins

Command Palette

Search for a command to run...

TIL

  • February 8, 2025

    go
    Why does Go's io.Reader have such a weird signature?

    Understand why io.Reader takes a byte slice parameter instead of returning one. Learn about heap allocations and buffer reuse in Go streams.

  • 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.