Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Concurrency Patterns in Go: context, sync, errgroup, Worker Pools and Goroutine Leaks
In Go, data accessed concurrently is either guarded by a mutex or handed to its owner over a channel; an unguarded map crashes the process, while an unguarded counter silently produces duplicate order IDs. Concurrent map writes and the race detector in Bookstore, fixing Service and memstore with mutexes, cancellation and deadlines with context, WaitGroup.Go, a 10,000-invoice worker pool with errgroup, Go 1.27's goroutineleak profile, and running a 15-minute test instantly with synctest.
Global State in React: The Limits of Context, Zustand and When to Use Redux Toolkit
Most "global state" is really server, URL or form state; for the small client state that is truly global, Zustand's store with selectors fixes Context's render-every-reader problem, while Redux Toolkit comes in when you need an action log and rules for a large team. In Bookstore we move the recently viewed books and the cart id into a persisted store, and show reading without selectors causing 13 renders instead of 1 and a selector returning a new object looping forever in Zustand 5.
useRef, Context and Custom Hooks: DOM Access, Context Instead of DI and the Rules of Hooks
useRef is a box that does not trigger renders (a DOM node or a timer id), while Context carries a value deep into the tree without props and re-renders every component that reads it when it changes. We move the Bookstore cart, theme and user into Context, measure a version where a theme change renders 28 components instead of 2, and show an inline ref callback stealing focus, a conditional hook crashing the app and the search split into custom hooks.
Copilot Chat and Context: Ask, Edit, Agent and Plan Flows, #-References, the Workspace Index and Managing Context
Give Copilot Chat the files that hold the answer with #-references, not the whole repo, and ask a question that can be proven wrong: in Bookstore half of the context was a single package-lock.json, while the cancellation answer sat in a five-thousand-token slice and was 'there is no cancellation flow'. Ask, Plan and Agent; the workspace index, search.exclude and compaction.
Giving Agents the Right Context: AGENTS.md, copilot-instructions.md, CLAUDE.md and Path-Specific Instructions
The tool-neutral way to describe a repository to a coding agent is a short AGENTS.md at the root: build and test commands, folder layout, team rules and topics to ask about first. We cover which tool reads which file, nested and path-specific instructions, a real AGENTS.md for Bookstore, the results of the same task with three different contexts, and a check that catches stale instruction files.