
Go Data Structures
Go slice, map, and array idioms covering nil versus empty slices, append, sets, and copy safety.
- CCM score
- 67 of 100
- skills.sh installs
- 1.3K
- GitHub stars
- 197
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers slices, maps, and arrays: choosing
newversusmake, appending, declaring empty slices, and copying at boundaries - Includes a decision tree for picking arrays, slices, or maps, plus a
references/SLICES.mdfile on nil versus empty slices and aliasing - Enforces nil slices by default, with non-nil empty slices only when JSON must encode
[]rather thannull - Designed for Go developers building or manipulating collections; concurrent access is handled by a separate concurrency skill
Install
$ npx -y skills add cxuu/golang-skills --skill go-data-structures -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Go Data Structures
Resource Routing
references/SLICES.md- Read when deciding nil versus empty slices, copying slices, or managing slice capacity and aliasing.
Choosing a Data Structure
What do you need?
├─ Ordered collection of items
│ ├─ Fixed size known at compile time → Array [N]T
│ └─ Dynamic size → Slice []T
│ ├─ Know approximate size? → make([]T, 0, capacity)
│ └─ Unknown size or nil-safe for JSON? → var s []T (nil)
├─ Key-value lookup
│ └─ Map map[K]V
│ ├─ Know approximate size? → make(map[K]V, capacity)
│ └─ Need a set? → map[T]struct{} (zero-size values)
└─ Need to pass to a function?
└─ Copy at the boundary if the caller might mutate it
When this skill does NOT apply: For concurrent access to data structures (mutexes, atomic operations), see go-concurrency. For defensive copying at API boundaries, see go-defensive. For pre-sizing capacity for performance, see go-performance.
Slices
The append Function
Always assign the result — the underlying array may change:
x := []int{1, 2, 3}
x = append(x, 4, 5, 6)
Details
- Repository
- github.com/cxuu/golang-skills
- Category
- Go
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Control Flow1.3K
- Go Logging1.1K
- Go Generics1.1K
- Go Functions1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.5K
- Go Error Handling1.4K
- Go Concurrency1.4K
- Go Interfaces1.4K
- Go Linting1.4K
- Go Style Core1.4K
- Go Documentation1.4K
- Go Context1.4K
- Go Performance1.4K
- Go Naming1.3K
- Go Defensive1.3K
- Go Packages1.3K
- Go Functional Options1.3K
Similar to Go Data Structures
More Go
golang-data-structuressamber/cc-skills-golang42.7K installsReference guide covering Go slices, maps, arrays, container packages, generics, and pointer types with selection guidance.
golang-safetysamber/cc-skills-golang43.2K installsDefensive Go coding guidance against nil panics, append aliasing, silent truncation, and defer-in-loop leaks.
go-declarationscxuu/golang-skills1.1K installsGo declaration style guide covering var vs :=, iota enums, scope, struct and map initialization, and literal formatting.
go-concurrencycxuu/golang-skills1.4K installsGo concurrency guidance covering goroutine lifetimes, channel-versus-mutex choice, and safe shared state.
go-concurrency-patternssickn33/agentic-awesome-skills263 installsGo concurrency guidance covering goroutines, channels, sync primitives, and context for worker pools and race debugging.