What problem does it solve?
This Skill helps Go engineers pick the right data structures for performance, memory layout, and correctness by explaining how slices, maps, containers, strings, generics, and pointers actually behave.
Core Features & Use Cases
- Slices & Maps Internals: Understand capacity growth, preallocation, slice header aliasing risks, map bucket structure, and why maps don’t shrink after deletes.
- Standard Library Container Guidance: Select among container/list, container/heap, container/ring, and bufio based on access patterns and complexity tradeoffs.
- Correct String/Byte Buffer Choice: Prefer strings.Builder for building strings and bytes.Buffer for I/O and byte-oriented use cases, including Grow guidance.
- Generics & Pointer Safety: Use tight constraints (comparable, cmp.Ordered) and apply safe pointer patterns, including unsafe.Pointer’s spec-limited conversions and weak.Pointer usage for GC-friendly caches.
- Copy Semantics Decisioning: Predict when assignment copies headers vs values, and when shared backing arrays or references can cause subtle bugs.
Quick Start
Ask an AI coding agent to design a Go cache or container for your access pattern (reads/writes ratio, mutation frequency, ordering needs, and expected size) and justify each data-structure choice using slices/maps internals, copy semantics, and safety pitfalls.