golang-data-structures

golang data structures

samber ↓ 34k
Claude Code
View source ↗

What it does

  • < 256 elements: capacity doubles
  • > = 256 elements: grows by ~25% (newcap += (newcap + 3256) / 4)
  • Each growth copies the entire backing array — O(n)
  • emirpasic/gods — comprehensive collection library (trees, sets, lists, stacks, maps, queues)
  • deckarep/golang-set — thread-safe and non-thread-safe set implementations
  • gammazero/deque — fast double-ended queue
  • → See samber/cc-skills-golang@golang-performance skill for struct field alignment, memory layout optimization, and cache locality

Requirements & configuration

  • Use strings.Builder for pure string concatenation (avoids copy on String()), bytes.Buffer when you need io.Reader or byte manipulation. Both support Grow(n). Details and comparison
  • | interface | Value copied (type + value pair) | Depends on held type |

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

golang data structures

Source

Repository: https://github.com/samber/cc-skills-golang

golang-data-structures FAQ

What does the golang-data-structures skill do?

Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals. < 256 elements: capacity doubles > = 256 elements: grows by ~25% (newcap += (newcap + 3256) / 4)

What does golang-data-structures require?

Use strings.Builder for pure string concatenation (avoids copy on String()), bytes.Buffer when you need io.Reader or byte manipulation. Both support Grow(n). Details and comparison | interface | Value copied (type + value pair) | Depends on held type |

How do I install golang-data-structures?

Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-data-structures --agent claude-code — the source lives at github.com/samber/cc-skills-golang.

Maintain golang-data-structures?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

golang-data-structures on getagentictools
[![golang-data-structures on getagentictools](https://getagentictools.com/badge/skills/samber-cc-skills-golang-golang-data-structures.svg)](https://getagentictools.com/skills/samber-cc-skills-golang-golang-data-structures?ref=badge)
npx agentictools info skills/samber-cc-skills-golang-golang-data-structures

The second line is the CLI lookup for this page — handy in READMEs and docs.