Practical Go patterns: error handling, context, and concurrency

Practical Go patterns: error handling, context, and concurrency

Error handling in Go Go’s approach to error handling is often a topic of debate among developers. Some love it, some hate it, but one thing is for sure: it’s unique. In Go, errors are values, and you handle them using the if err != nil pattern. This might seem verbose, but it encourages explicit error checking and handling. The if err != nil pattern Let’s look at a simple example:...

July 10, 2026 · 4 min · 778 words · Maxim Zhirnov
Практические рисунка: обработка ошибок, контекст и параллелизм

Практические рисунка: обработка ошибок, контекст и параллелизм

Обработка ошибок в Go Подход к обработке ошибок в Go часто становится предметом споров среди разработчиков. Кому-то он нравится, кому-то нет, но одно можно сказать наверняка: он уникален. В Go ошибки являются значениями, и вы обрабатываете их с помощью шаблона if err != nil. Это может показаться многословным, но такой подход поощряет явную проверку и обработку ошибок. Шаблон if err != nil Рассмотрим простой пример: func readFile(filename string) ([]byte, error) { data, err := ioutil....

July 10, 2026 · 4 min · 705 words · Maxim Zhirnov
Building a Distributed Locking System in Go with ZooKeeper: From Theory to Production

Building a Distributed Locking System in Go with ZooKeeper: From Theory to Production

The Lock Dilemma: When sync.Mutex Just Isn’t Enough You know that feeling when you realize your precious in-process mutex won’t cut it anymore? Yeah, we’ve all been there. Your single-threaded assumptions worked fine until your system decided to grow up and become distributed. Suddenly, you’ve got multiple services running on different machines, all trying to access the same resource, and your sync.Mutex is sitting there looking confused—because it only locks things within a single process....

January 5, 2026 · 11 min · 2181 words · Maxim Zhirnov
Построение распределенной системы блокировки в Go с ZooKeeper: от теории к производству

Построение распределенной системы блокировки в Go с ZooKeeper: от теории к производству

Дилемма блокировки: когда sync.Mutex уже недостаточно Вы знаете это чувство, когда осознаёте, что ваш драгоценный мьютекс в процессе уже не справляется? Да, мы все бывали в такой ситуации. Ваши предположения об однопотоковом выполнении работали нормально, пока ваша система не решила вырасти и стать распределённой. Вдруг у вас появляется несколько сервисов, работающих на разных машинах, все пытаются получить доступ к одному и тому же ресурсу, а ваш sync.Mutex сидит и выглядит растерянным — потому что он блокирует только внутри одного процесса....

January 5, 2026 · 5 min · 988 words · Maxim Zhirnov
Mastering Go Concurrency: From Sequential Bottlenecks to Concurrent Bliss

Mastering Go Concurrency: From Sequential Bottlenecks to Concurrent Bliss

If you’ve ever written a program that felt like it was doing one thing at a time while the world demands it do seventeen things simultaneously, welcome to the pre-concurrent era. Lucky for you, Go was literally designed to make this pain go away. In fact, if you’ve heard the phrase “Go is perfect for concurrent systems,” it’s not marketing—it’s just developers who’ve experienced the alternative and are still recovering....

December 7, 2025 · 10 min · 2053 words · Maxim Zhirnov