Exploring the idiomatic approach to object initialization in Go and understanding why we use constructor functions to create new struct instances.
Read more →Posts tagged with golang
Defer's evaluation timing and named return values that get mutated after the return statement: two Go function features with no real TypeScript equivalent.
Read more →A method is just a function with a receiver, a nil interface panics differently than a nil pointer, and iota isn't a TypeScript enum — three Go idioms I had to unlearn my TS assumptions for.
Read more →Go collapses for, for-of, for-in, and forEach into one for, and a missing map key returns a zero value instead of undefined. Both are smaller languages on purpose.
Read more →Slice headers, nil comparisons, and pointer fields for optional values: three places Go's syntax looks like TypeScript but the semantics don't match.
Read more →Six Go patterns that compile cleanly and quietly do the wrong thing: loop capture, typed nil, slice aliasing, shadowed err, defer in a loop, and range copies.
Read more →