typeover
curriculum

Curriculum Idioms & ecosystem Common gotchas exercise 5 · fill-word

Common gotchas

Type the builtin function used to FORCE a fresh backing array when copying a slice. Pattern: ``go b := make([]int, len(src)) ${word}(b, src) `` This is the antidote to slice-aliasing surprises (exercise 2).

TypeScript reference
Fill the blanks →

About this theme

The "what bit me in code review" survival kit:

  • Loop variable capture (Go 1.22+ helped, but you should still know).
  • Nil interface vs nil concrete (a non-nil pointer inside an interface variable makes the interface non-nil).
  • Slice aliasing — two slices sharing a backing array.
  • Goroutine leaks — a goroutine waiting on a channel that nobody will ever send to.