[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F3H4MFRP3EZYP6JD88MDTR":3,"skill-same:01M6F3H4MFRP3EZYP6JD88MDTR":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6F3H4MFRP3EZYP6JD88MDTR","go-data-structures",null,"Use when working with Go slices, maps, or arrays — choosing between new and make, using append, declaring empty slices (nil vs literal for JSON), implementing sets with maps, and copying data at boundaries. Also use when building or manipulating collections, even if the user doesn't ask about allocation idioms. Does not cover concurrent data structure safety (see go-concurrency).","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fcxuu\u002Fgolang-skills\u002Fgo-data-structures\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"go","go data structures","data structures","data","Literal","google","with","about","style","collections","structure","arrays","concurrency","maps","use","ask","json","Effective Go","wiki","Safety","2026-11-10 10:12:30",false,"---\nname: go-data-structures\ndescription: Use when working with Go slices, maps, or arrays — choosing between new and make, using append, declaring empty slices (nil vs literal for JSON), implementing sets with maps, and copying data at boundaries. Also use when building or manipulating collections, even if the user doesn't ask about allocation idioms. Does not cover concurrent data structure safety (see go-concurrency).\nlicense: Apache-2.0\nmetadata:\n  sources: \"Effective Go, Google Style Guide, Uber Style Guide, Go Wiki CodeReviewComments\"\n---\n\n# Go Data Structures\n\n---\n\n## Choosing a Data Structure\n\n```\nWhat do you need?\n├─ Ordered collection of items\n│  ├─ Fixed size known at compile time → Array [N]T\n│  └─ Dynamic size → Slice []T\n│     ├─ Know approximate size? → make([]T, 0, capacity)\n│     └─ Unknown size or nil-safe for JSON? → var s []T (nil)\n├─ Key-value lookup\n│  └─ Map map[K]V\n│     ├─ Know approximate size? → make(map[K]V, capacity)\n│     └─ Need a set? → map[T]struct{} (zero-size values)\n└─ Need to pass to a function?\n   └─ Copy at the boundary if the caller might mutate it\n```\n\n> **When this skill does NOT apply**: For concurrent access to data structures (mutexes, atomic operations), see [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md). For defensive copying at API boundaries, see [go-defensive](..\u002Fgo-defensive\u002FSKILL.md). For pre-sizing capacity for performance, see [go-performance](..\u002Fgo-performance\u002FSKILL.md).\n\n---\n\n## Slices\n\n### The append Function\n\n**Always assign the result** — the underlying array may change:\n\n```go\nx := []int{1, 2, 3}\nx = append(x, 4, 5, 6)\n\n\u002F\u002F Append a slice to a slice\nx = append(x, y...)  \u002F\u002F Note the ...\n```\n\n### Two-Dimensional Slices\n\n**Independent inner slices** (can grow\u002Fshrink independently):\n\n```go\npicture := make([][]uint8, YSize)\nfor i := range picture {\n    picture[i] = make([]uint8, XSize)\n}\n```\n\n**Single allocation** (more efficient for fixed sizes):\n\n```go\npicture := make([][]uint8, YSize)\npixels := make([]uint8, XSize*YSize)\nfor i := range picture {\n    picture[i], pixels = pixels[:XSize], pixels[XSize:]\n}\n```\n\n> Read [references\u002FSLICES.md](references\u002FSLICES.md) when debugging unexpected slice behavior, sharing slices across goroutines, or working with slice headers.\n\n### Declaring Empty Slices\n\nPrefer nil slices over empty literals:\n\n```go\n\u002F\u002F Good: nil slice\nvar t []string\n\n\u002F\u002F Avoid: non-nil but zero-length\nt := []string{}\n```\n\nBoth have `len` and `cap` of zero, but the nil slice is the preferred style.\n\n**Exception for JSON**: A nil slice encodes to `null`, while `[]string{}`\nencodes to `[]`. Use non-nil when you need a JSON array.\n\nWhen designing interfaces, avoid distinguishing between nil and non-nil\nzero-length slices.\n\n---\n\n## Maps\n\n### Implementing a Set\n\nUse `map[T]bool` — idiomatic and reads naturally:\n\n```go\nattended := map[string]bool{\"Ann\": true, \"Joe\": true}\nif attended[person] {  \u002F\u002F false if not in map\n    fmt.Println(person, \"was at the meeting\")\n}\n```\n\n---\n\n## Copying\n\nBe careful when copying a struct from another package. If the type has methods\non its pointer type (`*T`), copying the value can cause aliasing bugs.\n\n**General rule:** Do not copy a value of type `T` if its methods are associated\nwith the pointer type `*T`. This applies to `bytes.Buffer`, `sync.Mutex`,\n`sync.WaitGroup`, and types containing them.\n\n```go\n\u002F\u002F Bad: copying a mutex\nvar mu sync.Mutex\nmu2 := mu  \u002F\u002F almost always a bug\n\n\u002F\u002F Good: pass by pointer\nfunc increment(sc *SafeCounter) {\n    sc.mu.Lock()\n    sc.count++\n    sc.mu.Unlock()\n}\n```\n\n---\n\n## Quick Reference\n\n| Topic | Key Point |\n|-------|-----------|\n| Slices | Always assign `append` result; `nil` slice preferred over `[]T{}` |\n| Sets | `map[T]bool` is idiomatic |\n| Copying | Don't copy `T` if methods are on `*T`; beware aliasing |\n\n## Related Skills\n\n- **Defensive copying**: See [go-defensive](..\u002Fgo-defensive\u002FSKILL.md) when copying slices or maps at API boundaries to prevent mutation\n- **Capacity hints**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when pre-sizing slices or maps for known workloads\n- **Iteration patterns**: See [go-control-flow](..\u002Fgo-control-flow\u002FSKILL.md) when using range loops over slices, maps, or channels\n- **Declaration style**: See [go-declarations](..\u002Fgo-declarations\u002FSKILL.md) when choosing between `new`, `make`, `var`, and composite literals\n\n","# Go Data Structures\n\n---\n\n## Choosing a Data Structure\n\n```\nWhat do you need?\n├─ Ordered collection of items\n│  ├─ Fixed size known at compile time → Array [N]T\n│  └─ Dynamic size → Slice []T\n│     ├─ Know approximate size? → make([]T, 0, capacity)\n│     └─ Unknown size or nil-safe for JSON? → var s []T (nil)\n├─ Key-value lookup\n│  └─ Map map[K]V\n│     ├─ Know approximate size? → make(map[K]V, capacity)\n│     └─ Need a set? → map[T]struct{} (zero-size values)\n└─ Need to pass to a function?\n   └─ Copy at the boundary if the caller might mutate it\n```\n\n> **When this skill does NOT apply**: For concurrent access to data structures (mutexes, atomic operations), see [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md). For defensive copying at API boundaries, see [go-defensive](..\u002Fgo-defensive\u002FSKILL.md). For pre-sizing capacity for performance, see [go-performance](..\u002Fgo-performance\u002FSKILL.md).\n\n---\n\n## Slices\n\n### The append Function\n\n**Always assign the result** — the underlying array may change:\n\n```go\nx := []int{1, 2, 3}\nx = append(x, 4, 5, 6)\n\n\u002F\u002F Append a slice to a slice\nx = append(x, y...)  \u002F\u002F Note the ...\n```\n\n### Two-Dimensional Slices\n\n**Independent inner slices** (can grow\u002Fshrink independently):\n\n```go\npicture := make([][]uint8, YSize)\nfor i := range picture {\n    picture[i] = make([]uint8, XSize)\n}\n```\n\n**Single allocation** (more efficient for fixed sizes):\n\n```go\npicture := make([][]uint8, YSize)\npixels := make([]uint8, XSize*YSize)\nfor i := range picture {\n    picture[i], pixels = pixels[:XSize], pixels[XSize:]\n}\n```\n\n> Read [references\u002FSLICES.md](references\u002FSLICES.md) when debugging unexpected slice behavior, sharing slices across goroutines, or working with slice headers.\n\n### Declaring Empty Slices\n\nPrefer nil slices over empty literals:\n\n```go\n\u002F\u002F Good: nil slice\nvar t []string\n\n\u002F\u002F Avoid: non-nil but zero-length\nt := []string{}\n```\n\nBoth have `len` and `cap` of zero, but the nil slice is the preferred style.\n\n**Exception for JSON**: A nil slice encodes to `null`, while `[]string{}`\nencodes to `[]`. Use non-nil when you need a JSON array.\n\nWhen designing interfaces, avoid distinguishing between nil and non-nil\nzero-length slices.\n\n---\n\n## Maps\n\n### Implementing a Set\n\nUse `map[T]bool` — idiomatic and reads naturally:\n\n```go\nattended := map[string]bool{\"Ann\": true, \"Joe\": true}\nif attended[person] {  \u002F\u002F false if not in map\n    fmt.Println(person, \"was at the meeting\")\n}\n```\n\n---\n\n## Copying\n\nBe careful when copying a struct from another package. If the type has methods\non its pointer type (`*T`), copying the value can cause aliasing bugs.\n\n**General rule:** Do not copy a value of type `T` if its methods are associated\nwith the pointer type `*T`. This applies to `bytes.Buffer`, `sync.Mutex`,\n`sync.WaitGroup`, and types containing them.\n\n```go\n\u002F\u002F Bad: copying a mutex\nvar mu sync.Mutex\nmu2 := mu  \u002F\u002F almost always a bug\n\n\u002F\u002F Good: pass by pointer\nfunc increment(sc *SafeCounter) {\n    sc.mu.Lock()\n    sc.count++\n    sc.mu.Unlock()\n}\n```\n\n---\n\n## Quick Reference\n\n| Topic | Key Point |\n|-------|-----------|\n| Slices | Always assign `append` result; `nil` slice preferred over `[]T{}` |\n| Sets | `map[T]bool` is idiomatic |\n| Copying | Don't copy `T` if methods are on `*T`; beware aliasing |\n\n## Related Skills\n\n- **Defensive copying**: See [go-defensive](..\u002Fgo-defensive\u002FSKILL.md) when copying slices or maps at API boundaries to prevent mutation\n- **Capacity hints**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when pre-sizing slices or maps for known workloads\n- **Iteration patterns**: See [go-control-flow](..\u002Fgo-control-flow\u002FSKILL.md) when using range loops over slices, maps, or channels\n- **Declaration style**: See [go-declarations](..\u002Fgo-declarations\u002FSKILL.md) when choosing between `new`, `make`, `var`, and composite literals\n\n",{"name":5,"license":15,"metadata":44,"description":7},{"sources":45},"Effective Go, Google Style Guide, Uber Style Guide, Go Wiki CodeReviewComments","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fcxuu\u002Fgolang-skills\u002Fgo-data-structures",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill go-data-structures",{"tool":61,"command":62},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill go-data-structures",{"tool":64,"command":65},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill go-data-structures","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fcxuu\u002Fgolang-skills\u002Fgo-data-structures\u002FSKILL.md",true,[],[70,80,89,98,104,110],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[77,78,79],"model","model hierarchy","model hierarchy skill",{"skillNo":81,"name":82,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[86,87,88],"MCP","zoom","zoom mcp",{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[95,96,97,87],"sdk","zoom apps sdk","apps",{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[100],{"skillNo":105,"name":106,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[106],{"skillNo":111,"name":112,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[112]]