Blog

Posts in 2025
  • Nested Assignments

    Saturday, December 27, 2025 in Blog

    We finished the previous post with a riddle, so let’s start this one with another. What does the following code print? var ( a, b = 1, 2 c = &a ) c, *c = func() (*int, int) { c, a = &b, 3; a := b; return nil, a }() fmt.Println(a, b) Try …

    Read more

  • Shadowing in Go

    Monday, December 22, 2025 in Blog

    In the previous post, we discussed why minimizing identifier scope is beneficial for maintainable Go code. Tightly scoped variables reduce cognitive load and make refactoring easier. However, we might sometimes choose a slightly wider scope to reduce …

    Read more

  • Minimize Identifier Scope in Go

    Wednesday, November 19, 2025 in Blog

    Have you ever spent hours debugging a subtle issue, only to discover it was caused by a variable being accidentally reused 200 lines away from its declaration? Or found yourself scrolling up and down a long function, trying to track where a variable …

    Read more

  • The Day the Linter Broke My Code

    Monday, September 15, 2025 in Blog

    Another Story… Imagine you were given a task to design errors for your service. DataEOFError should contain the name of the data file and be considered equal to io.ErrUnexpectedEOF. ProcessingFailedError should contain a processing ID as a string and …

    Read more

  • Understanding Go Error Types: Pointer vs. Value

    Wednesday, August 13, 2025 in Blog

    A Small Story… Imagine you have to rewrite cluster autoscaling. There’s a function makeNodeSchedulable that rarely returns a CriticalAddonsOnlyError when that node has a CriticalAddonsOnly taint. The old code looks like this: makeSchedulableLoop: for …

    Read more

  • A Zero-Sized Bug Hunt in golang.org/x/sync

    Wednesday, July 02, 2025 in Blog

    … continued from the previous post. While researching the usage of zero-sized types in Go I wrote zerolint1 and the accompanying cmplint2 and examined over 500 popular Go projects. I want to look into some examples why I think those linters …

    Read more

  • The Perils of Pointers in the Land of the Zero-Sized Type

    Saturday, May 31, 2025 in Blog

    Imagine writing a translation function that transforms internal errors into public API errors. In the first iteration, you return nil when no translation takes place. You make a simple change — returning the original error instead of nil — and …

    Read more

Posts in 2024