Step 3 / Select topic Go Hard
What this bank covers
- Go integer division, remainder, and right shift with negatives
- Complex types: untyped constants, complex/real/imag, complex64
- Go: int8 overflow in / -1, negation, and signed vs unsigned shifts
- Cutset trimming versus literal prefix trimming
- Mixing a typed operand with an untyped constant
- Unary complement combined with AND NOT
- Sized integer operands: shifts, truncated division and wraparound
- Lexicographic byte-wise string comparison
- Ring.Unlink when n is a multiple of the length
- Go binary operator precedence
- Integer division and remainder signs
- AND NOT (&^) versus XOR (^)
- Untyped constants versus float32 precision
- Constant vs float64 arithmetic
- Five ways to round -2.5
- Truncating integer conversions
- The 2^53 gap in float64
- Bit counting helpers
- QuoRem versus DivMod
- Negative zero in float64
- Shift counts and width
- Round-half-to-even in fmt
- len counts bytes, not characters
- Split edge cases: empty separator and empty input
- ToUpper applies simple case mapping only
- Index results are byte offsets, and empty substrings are special
- Count with an empty substring counts rune boundaries
- EqualFold uses Unicode simple folding
- Fields collapses whitespace runs, Split does not
- Range expression is evaluated once
- Ranging over an array copies it
- Range over string yields byte index and rune
- Range over an integer
- Range over func and the yield protocol
- maps.Keys/Values return iterators
- Ranging over a closed channel
- Per-iteration loop variables
- Ranging over nil maps and slices
- Range over a pointer to array is not always evaluated
- Full slice expressions cap the reslice
- copy handles overlapping slices
- NaN keys in a Go map
- Doubly linked list reordering
- Two appends to one spare slot
- Missing keys, zero values, and delete
- Less decides heap orientation
- Arrays are comparable map keys
- Reads and writes on a nil map
- Deferred functions can modify named results only
- Implicit blocks in if and switch create nested scopes
- Defer argument evaluation time versus closure capture
- recover only works when called directly by a deferred function
- Method values bind the receiver when they are evaluated
- A variadic parameter can be nil or empty-but-non-nil
- Package variables initialize by dependency, init funcs in source order
- Recovering inside a defer can rewrite named results
- Function operands are evaluated in lexical left-to-right order
- Defer is scoped to the function, not the enclosing block
- Typed nil stored in an error interface
- Defer order during panicking and recovery
- sync.Once treats a panicking f as done
- A nil channel case is never ready
- close drains, it does not discard
- len and cap of a closed buffered channel
- Cancellation propagates to derived contexts
- A closed channel is always ready to receive
- CancelFunc is idempotent
- sync.Map LoadOrStore returns the existing value
- A WaitGroup counter must never go negative
- Disabling select cases by setting channels to nil
- Preallocation only avoids growth while capacity lasts
- Field ordering changes struct size because of alignment padding
- slices.Clip drops unused capacity
- string(b) as a map key copies the bytes
- slices.Grow reserves capacity without changing length
- copy is bounded by length, not capacity
- Spare capacity makes independent appends alias
- Reset semantics differ for Builder and Buffer
- Signed division is not a plain arithmetic shift
- iota counts lines, implicit repetition reuses the expression
- Converting a rune encodes UTF-8; converting a byte slice copies raw bytes
- A typed nil pointer stored in an interface is not nil
- Range copies elements; index to mutate them
- fallthrough ignores the next case's condition, and default is tried last
- Tuple assignment evaluates index operands before assigning
- Embedding promotes methods but gives no virtual dispatch
- case nil matches an empty interface; multi-type cases keep the original static type
- Labeled continue restarts the outer loop; labeled break exits it
- Interface comparison can panic on uncomparable dynamic types
- strings.Map and the negative sentinel
- strings.Cut when the separator is missing
- %w versus %v in fmt.Errorf
- errors.Join and multi-error unwrapping
- errors.As target assignment
- Panicking inside a deferred function
- break inside a switch inside a loop
- goto as a backward loop
- errors.Is honours a custom Is method
- Strength reduction on signed remainder
- Multiple %w verbs: Unwrap() []error vs errors.Unwrap