golang-data-structures

Select optimal Go data structures and apply safe usage patterns.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/tamago0224/kuroshio-mta --skill golang-data-structures-tamago0224
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-data-structures
Source: https://github.com/tamago0224/kuroshio-mta/tree/main/.agents/skills/golang-data-structures
Command: npx skills add https://github.com/tamago0224/kuroshio-mta --skill golang-data-structures-tamago0224

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps Go developers choose and use the right data structures—slices, maps, arrays, container types, and pointers—by exposing their internals, performance characteristics, and correct usage patterns, preventing bugs and inefficiencies.

Core Features & Use Cases

  • Deep internals: explains slice capacity growth, map bucket layout, and safe pointer usage.
  • Best‑practice guidance: preallocation, container selection, generic constraints, and unsafe pointer rules.
  • Reference links: detailed markdown references on slices, maps, containers, pointers, and generics for quick lookup. Use case: When optimizing a high‑throughput service, you can rely on this skill to decide whether to preallocate a map, use a heap, or employ weak pointers for cache eviction.

Quick Start

Ask the skill to recommend the most efficient Go container for a priority queue handling millions of items.

Frequently Asked Questions about golang-data-structures

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Go slices and maps for high-throughput services?

Optimize Go slices and maps by preallocating capacities to avoid runtime reallocation. This skill provides detailed preallocation guidelines, map bucket layout internals, and container selection criteria to prevent performance bottlenecks in high-throughput environments.

What is the best Go container for a priority queue processing millions of items?

The best Go container for a priority queue is a heap due to its efficient O(log n) insertions and extractions. This skill recommends optimal container types and applies safe usage patterns tailored for performance-critical code handling large datasets.

How does slice capacity growth work in Go?

Slice capacity growth in Go involves runtime reallocation and copying elements when appending beyond the current array bounds. This skill explains slice capacity growth internals and map bucket layouts, exposing performance characteristics for efficient memory usage.

Can I use unsafe and weak pointers for cache eviction in Go?

Yes, you can use unsafe and weak pointers for cache eviction in Go. This skill provides detailed rules for safe unsafe and weak pointer usage without code execution, ensuring efficient memory management while preventing bugs.

When do I need generics in Go data structures?

You need generics in Go data structures when creating reusable, type-safe containers that work across different types without code duplication. This skill details generic constraints and best-practice guidance for applying them to slices, maps, and custom containers.

What are the limitations of using unsafe pointers in Go?

Limitations of unsafe pointers in Go include potential memory corruption and garbage collector interference if mishandled. This skill outlines safe unsafe pointer rules and constraints to mitigate risks while optimizing performance-critical code.