Step 3 / Select topic Go Medium
What this bank covers
- Go: integer division, remainder, shifts and bitwise NOT
- Sized integer wraparound, conversion, ^ and &^ in Go
- len on a string counts bytes
- strings.Index returns the first byte offset
- strings.Join inserts the separator between elements
- Ranging over a custom iterator with break
- Variadic parameter with no arguments
- bytes.Buffer.Grow and the small-buffer bootstrap
- make([]int, n) versus make([]int, 0, n) when pre-sizing for append
- NaN is not equal to itself
- Positive infinity compares greater than every finite float64
- Binary, hexadecimal, and octal integer literals
- slices.Collect makes a new slice
- Two-value iteration with slices.All
- String range yields byte offsets of runes
- Map keys must be comparable
- Closures capture enclosing variables
- Loop variable scope in closures
- Shadowing across package, function, and block scope
- recover rewriting named results
- errors.As down a multi-level wrap chain
- fallthrough skips the next case's test
- break binds to the innermost switch, not the loop
- select chooses randomly among ready cases
- Nil channels disable a select case
- Closing a nil channel panics
- Context cancel functions are idempotent
- Closing an already-closed channel
- Index expressions on the left of a tuple assignment use the old values
- Rune literals print as numbers, not characters
- Appending to a re-slice can overwrite the original's elements
- strings.SplitN with a count of zero
- maps.Keys yields an iterable of keys that slices.Sorted can order
- iter.Pull's next returns the zero value and false once exhausted
- Division and remainder with negative operands
- The default type of a rune literal
- The &^ bit clear operator
- Shift counts larger than the operand width
- Interface comparison compares dynamic types too
- Wraparound on sized integer types
- Precedence of shift versus addition
- Unary ^ is bitwise complement
- Float64 addition and equality
- float64 rounding and equality
- strings.Count with an empty substring
- TrimLeft uses a cutset, not a prefix
- strings.SplitN limits the number of pieces
- strings.Replace with a count
- Indexing a string yields a byte, not a rune
- strings.Cut splits once at the first separator
- maps.Keys yields an iterator, not a slice
- slices.Backward keeps the original indices
- Writing a custom iter.Seq filter
- Range over function: early break
- container/heap pop order
- Deleting during map range
- Nil map reads and writes
- Shadowing in an if statement
- When deferred arguments are evaluated
- Deferred calls run last-in-first-out
- Each closure captures its own variable
- Slice parameters are passed by value
- Defer can modify a named result
- errors.Join matches every joined error
- continue with a label targets the outer loop
- Type switch case order and the nil case
- errors.As unwraps to a concrete error type
- errors.Is only follows a real Unwrap chain
- panic(nil) is replaced by a runtime error value
- sync.Once runs its function exactly once
- Closing a channel does not discard buffered values
- Fan-in with a buffered channel, WaitGroup, and range
- select with a time.After timeout arm
- sync.Mutex makes read-modify-write increments atomic
- copy is limited by length, not capacity
- Map size hints affect allocation, not len
- s = s[:0] recycles the backing array
- Arrays are values, slices are not
- TrimLeft takes a cutset, not a prefix
- %v versus %s for []byte
- encoding/json ignores unexported fields
- fmt reports formatting errors in the output
- Duration formatting normalizes units
- math.Mod and % both keep the dividend's sign
- Right shifting signed integers in Go
- container/heap pops the minimum first
- A slice-backed FIFO queue
- container/list is a doubly linked list
- Binary search returns an insertion point
- slices.Insert shifts the tail right
- Range copies struct elements
- Grow reserves capacity, not length
- Converting []byte to string copies
- Appending numbers into a reusable buffer
- strings.Builder.Grow reserves capacity, not length
- strings.Split on an empty string
- math.Round rounds half away from zero
- Converting float64 to int truncates toward zero
- Untyped constant division in Go
- Pre-sizing a slice avoids regrowth