[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-jetbrains-use-modern-go":3,"mdc--yqruzh-key":32,"related-repo-jetbrains-use-modern-go":2239,"related-org-jetbrains-use-modern-go":2247},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":22,"repoUrl":23,"updatedAt":24,"license":25,"forks":26,"topics":27,"repo":28,"sourceUrl":30,"mdContent":31},"use-modern-go","apply modern Go syntax guidelines","Apply modern Go syntax guidelines based on project's Go version. Use when user ask for modern Go code guidelines.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"jetbrains","JetBrains","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fjetbrains.png",[12,16,19],{"name":13,"slug":14,"type":15},"Best Practices","best-practices","tag",{"name":17,"slug":18,"type":15},"Engineering","engineering",{"name":20,"slug":21,"type":15},"Go","go",790,"https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fgo-modern-guidelines","2026-07-13T06:38:29.960275",null,32,[],{"repoUrl":23,"stars":22,"forks":26,"topics":29,"description":25},[],"https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fgo-modern-guidelines\u002Ftree\u002FHEAD\u002Fclaude\u002Fmodern-go-guidelines\u002Fskills\u002Fuse-modern-go","---\nname: use-modern-go\ndescription: Apply modern Go syntax guidelines based on project's Go version. Use when user ask for modern Go code guidelines.\n---\n\n# Modern Go Guidelines\n\n## Detected Go Version\n\n!`grep -rh \"^go \" --include=\"go.mod\" . 2>\u002Fdev\u002Fnull | cut -d' ' -f2 | sort | uniq -c | sort -nr | head -1 | xargs | cut -d' ' -f2 | grep . || echo unknown`\n\n## How to Use This Skill\n\nDO NOT search for go.mod files or try to detect the version yourself. Use ONLY the version shown above.\n\n**If version detected (not \"unknown\"):**\n- Say: \"This project is using Go X.XX, so I’ll stick to modern Go best practices and freely use language features up to and including this version. If you’d prefer a different target version, just let me know.\"\n- Do NOT list features, do NOT ask for confirmation\n\n**If version is \"unknown\":**\n- Say: \"Could not detect Go version in this repository\"\n- Use AskUserQuestion: \"Which Go version should I target?\" → [1.23] \u002F [1.24] \u002F [1.25] \u002F [1.26]\n\n**When writing Go code**, use ALL features from this document up to the target version:\n- Prefer modern built-ins and packages (`slices`, `maps`, `cmp`) over legacy patterns\n- Never use features from newer Go versions than the target\n- Never use outdated patterns when a modern alternative is available\n\n---\n\n## Features by Go Version\n\n### Go 1.0+\n\n- `time.Since`: `time.Since(start)` instead of `time.Now().Sub(start)`\n\n### Go 1.8+\n\n- `time.Until`: `time.Until(deadline)` instead of `deadline.Sub(time.Now())`\n\n### Go 1.13+\n\n- `errors.Is`: `errors.Is(err, target)` instead of `err == target` (works with wrapped errors)\n\n### Go 1.18+\n\n- `any`: Use `any` instead of `interface{}`\n- `bytes.Cut`: `before, after, found := bytes.Cut(b, sep)` instead of Index+slice\n- `strings.Cut`: `before, after, found := strings.Cut(s, sep)`\n\n### Go 1.19+\n\n- `fmt.Appendf`: `buf = fmt.Appendf(buf, \"x=%d\", x)` instead of `[]byte(fmt.Sprintf(...))`\n- `atomic.Bool`\u002F`atomic.Int64`\u002F`atomic.Pointer[T]`: Type-safe atomics instead of `atomic.StoreInt32`\n\n```go\nvar flag atomic.Bool\nflag.Store(true)\nif flag.Load() { ... }\n\nvar ptr atomic.Pointer[Config]\nptr.Store(cfg)\n```\n\n### Go 1.20+\n\n- `strings.Clone`: `strings.Clone(s)` to copy string without sharing memory\n- `bytes.Clone`: `bytes.Clone(b)` to copy byte slice\n- `strings.CutPrefix\u002FCutSuffix`: `if rest, ok := strings.CutPrefix(s, \"pre:\"); ok { ... }`\n- `errors.Join`: `errors.Join(err1, err2)` to combine multiple errors\n- `context.WithCancelCause`: `ctx, cancel := context.WithCancelCause(parent)` then `cancel(err)`\n- `context.Cause`: `context.Cause(ctx)` to get the error that caused cancellation\n\n### Go 1.21+\n\n**Built-ins:**\n- `min`\u002F`max`: `max(a, b)` instead of if\u002Felse comparisons\n- `clear`: `clear(m)` to delete all map entries, `clear(s)` to zero slice elements\n\n**slices package:**\n- `slices.Contains`: `slices.Contains(items, x)` instead of manual loops\n- `slices.Index`: `slices.Index(items, x)` returns index (-1 if not found)\n- `slices.IndexFunc`: `slices.IndexFunc(items, func(item T) bool { return item.ID == id })`\n- `slices.SortFunc`: `slices.SortFunc(items, func(a, b T) int { return cmp.Compare(a.X, b.X) })`\n- `slices.Sort`: `slices.Sort(items)` for ordered types\n- `slices.Max`\u002F`slices.Min`: `slices.Max(items)` instead of manual loop\n- `slices.Reverse`: `slices.Reverse(items)` instead of manual swap loop\n- `slices.Compact`: `slices.Compact(items)` removes consecutive duplicates in-place\n- `slices.Clip`: `slices.Clip(s)` removes unused capacity\n- `slices.Clone`: `slices.Clone(s)` creates a copy\n\n**maps package:**\n- `maps.Clone`: `maps.Clone(m)` instead of manual map iteration\n- `maps.Copy`: `maps.Copy(dst, src)` copies entries from src to dst\n- `maps.DeleteFunc`: `maps.DeleteFunc(m, func(k K, v V) bool { return condition })`\n\n**sync package:**\n- `sync.OnceFunc`: `f := sync.OnceFunc(func() { ... })` instead of `sync.Once` + wrapper\n- `sync.OnceValue`: `getter := sync.OnceValue(func() T { return computeValue() })`\n\n**context package:**\n- `context.AfterFunc`: `stop := context.AfterFunc(ctx, cleanup)` runs cleanup on cancellation\n- `context.WithTimeoutCause`: `ctx, cancel := context.WithTimeoutCause(parent, d, err)`\n- `context.WithDeadlineCause`: Similar with deadline instead of duration\n\n### Go 1.22+\n\n**Loops:**\n- `for i := range n`: `for i := range len(items)` instead of `for i := 0; i \u003C len(items); i++`\n- Loop variables are now safe to capture in goroutines (each iteration has its own copy)\n\n**cmp package:**\n- `cmp.Or`: `cmp.Or(flag, env, config, \"default\")` returns first non-zero value\n\n```go\n\u002F\u002F Instead of:\nname := os.Getenv(\"NAME\")\nif name == \"\" {\n    name = \"default\"\n}\n\u002F\u002F Use:\nname := cmp.Or(os.Getenv(\"NAME\"), \"default\")\n```\n\n**reflect package:**\n- `reflect.TypeFor`: `reflect.TypeFor[T]()` instead of `reflect.TypeOf((*T)(nil)).Elem()`\n\n**net\u002Fhttp:**\n- Enhanced `http.ServeMux` patterns: `mux.HandleFunc(\"GET \u002Fapi\u002F{id}\", handler)` with method and path params\n- `r.PathValue(\"id\")` to get path parameters\n\n### Go 1.23+\n\n- `maps.Keys(m)` \u002F `maps.Values(m)` return iterators\n- `slices.Collect(iter)` not manual loop to build slice from iterator\n- `slices.Sorted(iter)` to collect and sort in one step\n\n```go\nkeys := slices.Collect(maps.Keys(m))       \u002F\u002F not: for k := range m { keys = append(keys, k) }\nsortedKeys := slices.Sorted(maps.Keys(m))  \u002F\u002F collect + sort\nfor k := range maps.Keys(m) { process(k) } \u002F\u002F iterate directly\n```\n\n**time package**\n\n- `time.Tick`: Use `time.Tick` freely — as of Go 1.23, the garbage collector can recover unreferenced tickers, even if they haven't been stopped. The Stop method is no longer necessary to help the garbage collector. There is no longer any reason to prefer NewTicker when Tick will do.\n\n### Go 1.24+\n\n- `t.Context()` not `context.WithCancel(context.Background())` in tests.\n  ALWAYS use t.Context() when a test function needs a context.\n\nBefore:\n```go\nfunc TestFoo(t *testing.T) {\n    ctx, cancel := context.WithCancel(context.Background())\n    defer cancel()\n    result := doSomething(ctx)\n}\n```\nAfter:\n```go\nfunc TestFoo(t *testing.T) {\n    ctx := t.Context()\n    result := doSomething(ctx)\n}\n```\n\n- `omitzero` not `omitempty` in JSON struct tags.\n  ALWAYS use omitzero for time.Duration, time.Time, structs, slices, maps.\n\nBefore:\n```go\ntype Config struct {\n    Timeout time.Duration `json:\"timeout,omitempty\"` \u002F\u002F doesn't work for Duration!\n}\n```\nAfter:\n```go\ntype Config struct {\n    Timeout time.Duration `json:\"timeout,omitzero\"`\n}\n```\n\n- `b.Loop()` not `for i := 0; i \u003C b.N; i++` in benchmarks.\n  ALWAYS use b.Loop() for the main loop in benchmark functions.\n\nBefore:\n```go\nfunc BenchmarkFoo(b *testing.B) {\n    for i := 0; i \u003C b.N; i++ {\n        doWork()\n    }\n}\n```\nAfter:\n```go\nfunc BenchmarkFoo(b *testing.B) {\n    for b.Loop() {\n        doWork()\n    }\n}\n```\n\n- `strings.SplitSeq` not `strings.Split` when iterating.\n  ALWAYS use SplitSeq\u002FFieldsSeq when iterating over split results in a for-range loop.\n\nBefore:\n```go\nfor _, part := range strings.Split(s, \",\") {\n    process(part)\n}\n```\nAfter:\n```go\nfor part := range strings.SplitSeq(s, \",\") {\n    process(part)\n}\n```\nAlso: `strings.FieldsSeq`, `bytes.SplitSeq`, `bytes.FieldsSeq`.\n\n### Go 1.25+\n\n- `wg.Go(fn)` not `wg.Add(1)` + `go func() { defer wg.Done(); ... }()`.\n  ALWAYS use wg.Go() when spawning goroutines with sync.WaitGroup.\n\nBefore:\n```go\nvar wg sync.WaitGroup\nfor _, item := range items {\n    wg.Add(1)\n    go func() {\n        defer wg.Done()\n        process(item)\n    }()\n}\nwg.Wait()\n```\nAfter:\n```go\nvar wg sync.WaitGroup\nfor _, item := range items {\n    wg.Go(func() {\n        process(item)\n    })\n}\nwg.Wait()\n```\n\n### Go 1.26+\n\n- `new(val)` not `x := val; &x` — returns pointer to any value.\n  Go 1.26 extends new() to accept expressions, not just types.\n  Type is inferred: new(0) → *int, new(\"s\") → *string, new(T{}) → *T.\n  DO NOT use `x := val; &x` pattern — always use new(val) directly.\n  DO NOT use redundant casts like new(int(0)) — just write new(0).\n  Common use case: struct fields with pointer types.\n\nBefore:\n```go\ntimeout := 30\ndebug := true\ncfg := Config{\n    Timeout: &timeout,\n    Debug:   &debug,\n}\n```\nAfter:\n```go\ncfg := Config{\n    Timeout: new(30),   \u002F\u002F *int\n    Debug:   new(true), \u002F\u002F *bool\n}\n```\n\n- `errors.AsType[T](err)` not `errors.As(err, &target)`.\n  ALWAYS use errors.AsType when checking if error matches a specific type.\n\nBefore:\n```go\nvar pathErr *os.PathError\nif errors.As(err, &pathErr) {\n    handle(pathErr)\n}\n```\nAfter:\n```go\nif pathErr, ok := errors.AsType[*os.PathError](err); ok {\n    handle(pathErr)\n}\n```\n",{"data":33,"body":34},{"name":4,"description":6},{"type":35,"children":36},"root",[37,46,53,66,72,77,86,101,109,147,157,198,202,208,215,243,249,275,281,309,315,375,381,439,505,511,626,632,640,694,702,888,896,951,959,1003,1011,1059,1065,1073,1104,1112,1133,1197,1205,1231,1239,1274,1280,1323,1354,1362,1382,1388,1410,1415,1461,1466,1502,1523,1527,1557,1561,1590,1611,1615,1661,1665,1708,1729,1733,1763,1767,1796,1823,1829,1858,1862,1942,1946,2004,2010,2038,2042,2096,2100,2137,2158,2162,2200,2204,2233],{"type":38,"tag":39,"props":40,"children":42},"element","h1",{"id":41},"modern-go-guidelines",[43],{"type":44,"value":45},"text","Modern Go Guidelines",{"type":38,"tag":47,"props":48,"children":50},"h2",{"id":49},"detected-go-version",[51],{"type":44,"value":52},"Detected Go Version",{"type":38,"tag":54,"props":55,"children":56},"p",{},[57,59],{"type":44,"value":58},"!",{"type":38,"tag":60,"props":61,"children":63},"code",{"className":62},[],[64],{"type":44,"value":65},"grep -rh \"^go \" --include=\"go.mod\" . 2>\u002Fdev\u002Fnull | cut -d' ' -f2 | sort | uniq -c | sort -nr | head -1 | xargs | cut -d' ' -f2 | grep . || echo unknown",{"type":38,"tag":47,"props":67,"children":69},{"id":68},"how-to-use-this-skill",[70],{"type":44,"value":71},"How to Use This Skill",{"type":38,"tag":54,"props":73,"children":74},{},[75],{"type":44,"value":76},"DO NOT search for go.mod files or try to detect the version yourself. Use ONLY the version shown above.",{"type":38,"tag":54,"props":78,"children":79},{},[80],{"type":38,"tag":81,"props":82,"children":83},"strong",{},[84],{"type":44,"value":85},"If version detected (not \"unknown\"):",{"type":38,"tag":87,"props":88,"children":89},"ul",{},[90,96],{"type":38,"tag":91,"props":92,"children":93},"li",{},[94],{"type":44,"value":95},"Say: \"This project is using Go X.XX, so I’ll stick to modern Go best practices and freely use language features up to and including this version. If you’d prefer a different target version, just let me know.\"",{"type":38,"tag":91,"props":97,"children":98},{},[99],{"type":44,"value":100},"Do NOT list features, do NOT ask for confirmation",{"type":38,"tag":54,"props":102,"children":103},{},[104],{"type":38,"tag":81,"props":105,"children":106},{},[107],{"type":44,"value":108},"If version is \"unknown\":",{"type":38,"tag":87,"props":110,"children":111},{},[112,117],{"type":38,"tag":91,"props":113,"children":114},{},[115],{"type":44,"value":116},"Say: \"Could not detect Go version in this repository\"",{"type":38,"tag":91,"props":118,"children":119},{},[120,122,128,130,135,136,141,142],{"type":44,"value":121},"Use AskUserQuestion: \"Which Go version should I target?\" → ",{"type":38,"tag":123,"props":124,"children":125},"span",{},[126],{"type":44,"value":127},"1.23",{"type":44,"value":129}," \u002F ",{"type":38,"tag":123,"props":131,"children":132},{},[133],{"type":44,"value":134},"1.24",{"type":44,"value":129},{"type":38,"tag":123,"props":137,"children":138},{},[139],{"type":44,"value":140},"1.25",{"type":44,"value":129},{"type":38,"tag":123,"props":143,"children":144},{},[145],{"type":44,"value":146},"1.26",{"type":38,"tag":54,"props":148,"children":149},{},[150,155],{"type":38,"tag":81,"props":151,"children":152},{},[153],{"type":44,"value":154},"When writing Go code",{"type":44,"value":156},", use ALL features from this document up to the target version:",{"type":38,"tag":87,"props":158,"children":159},{},[160,188,193],{"type":38,"tag":91,"props":161,"children":162},{},[163,165,171,173,179,180,186],{"type":44,"value":164},"Prefer modern built-ins and packages (",{"type":38,"tag":60,"props":166,"children":168},{"className":167},[],[169],{"type":44,"value":170},"slices",{"type":44,"value":172},", ",{"type":38,"tag":60,"props":174,"children":176},{"className":175},[],[177],{"type":44,"value":178},"maps",{"type":44,"value":172},{"type":38,"tag":60,"props":181,"children":183},{"className":182},[],[184],{"type":44,"value":185},"cmp",{"type":44,"value":187},") over legacy patterns",{"type":38,"tag":91,"props":189,"children":190},{},[191],{"type":44,"value":192},"Never use features from newer Go versions than the target",{"type":38,"tag":91,"props":194,"children":195},{},[196],{"type":44,"value":197},"Never use outdated patterns when a modern alternative is available",{"type":38,"tag":199,"props":200,"children":201},"hr",{},[],{"type":38,"tag":47,"props":203,"children":205},{"id":204},"features-by-go-version",[206],{"type":44,"value":207},"Features by Go Version",{"type":38,"tag":209,"props":210,"children":212},"h3",{"id":211},"go-10",[213],{"type":44,"value":214},"Go 1.0+",{"type":38,"tag":87,"props":216,"children":217},{},[218],{"type":38,"tag":91,"props":219,"children":220},{},[221,227,229,235,237],{"type":38,"tag":60,"props":222,"children":224},{"className":223},[],[225],{"type":44,"value":226},"time.Since",{"type":44,"value":228},": ",{"type":38,"tag":60,"props":230,"children":232},{"className":231},[],[233],{"type":44,"value":234},"time.Since(start)",{"type":44,"value":236}," instead of ",{"type":38,"tag":60,"props":238,"children":240},{"className":239},[],[241],{"type":44,"value":242},"time.Now().Sub(start)",{"type":38,"tag":209,"props":244,"children":246},{"id":245},"go-18",[247],{"type":44,"value":248},"Go 1.8+",{"type":38,"tag":87,"props":250,"children":251},{},[252],{"type":38,"tag":91,"props":253,"children":254},{},[255,261,262,268,269],{"type":38,"tag":60,"props":256,"children":258},{"className":257},[],[259],{"type":44,"value":260},"time.Until",{"type":44,"value":228},{"type":38,"tag":60,"props":263,"children":265},{"className":264},[],[266],{"type":44,"value":267},"time.Until(deadline)",{"type":44,"value":236},{"type":38,"tag":60,"props":270,"children":272},{"className":271},[],[273],{"type":44,"value":274},"deadline.Sub(time.Now())",{"type":38,"tag":209,"props":276,"children":278},{"id":277},"go-113",[279],{"type":44,"value":280},"Go 1.13+",{"type":38,"tag":87,"props":282,"children":283},{},[284],{"type":38,"tag":91,"props":285,"children":286},{},[287,293,294,300,301,307],{"type":38,"tag":60,"props":288,"children":290},{"className":289},[],[291],{"type":44,"value":292},"errors.Is",{"type":44,"value":228},{"type":38,"tag":60,"props":295,"children":297},{"className":296},[],[298],{"type":44,"value":299},"errors.Is(err, target)",{"type":44,"value":236},{"type":38,"tag":60,"props":302,"children":304},{"className":303},[],[305],{"type":44,"value":306},"err == target",{"type":44,"value":308}," (works with wrapped errors)",{"type":38,"tag":209,"props":310,"children":312},{"id":311},"go-118",[313],{"type":44,"value":314},"Go 1.18+",{"type":38,"tag":87,"props":316,"children":317},{},[318,341,359],{"type":38,"tag":91,"props":319,"children":320},{},[321,327,329,334,335],{"type":38,"tag":60,"props":322,"children":324},{"className":323},[],[325],{"type":44,"value":326},"any",{"type":44,"value":328},": Use ",{"type":38,"tag":60,"props":330,"children":332},{"className":331},[],[333],{"type":44,"value":326},{"type":44,"value":236},{"type":38,"tag":60,"props":336,"children":338},{"className":337},[],[339],{"type":44,"value":340},"interface{}",{"type":38,"tag":91,"props":342,"children":343},{},[344,350,351,357],{"type":38,"tag":60,"props":345,"children":347},{"className":346},[],[348],{"type":44,"value":349},"bytes.Cut",{"type":44,"value":228},{"type":38,"tag":60,"props":352,"children":354},{"className":353},[],[355],{"type":44,"value":356},"before, after, found := bytes.Cut(b, sep)",{"type":44,"value":358}," instead of Index+slice",{"type":38,"tag":91,"props":360,"children":361},{},[362,368,369],{"type":38,"tag":60,"props":363,"children":365},{"className":364},[],[366],{"type":44,"value":367},"strings.Cut",{"type":44,"value":228},{"type":38,"tag":60,"props":370,"children":372},{"className":371},[],[373],{"type":44,"value":374},"before, after, found := strings.Cut(s, sep)",{"type":38,"tag":209,"props":376,"children":378},{"id":377},"go-119",[379],{"type":44,"value":380},"Go 1.19+",{"type":38,"tag":87,"props":382,"children":383},{},[384,407],{"type":38,"tag":91,"props":385,"children":386},{},[387,393,394,400,401],{"type":38,"tag":60,"props":388,"children":390},{"className":389},[],[391],{"type":44,"value":392},"fmt.Appendf",{"type":44,"value":228},{"type":38,"tag":60,"props":395,"children":397},{"className":396},[],[398],{"type":44,"value":399},"buf = fmt.Appendf(buf, \"x=%d\", x)",{"type":44,"value":236},{"type":38,"tag":60,"props":402,"children":404},{"className":403},[],[405],{"type":44,"value":406},"[]byte(fmt.Sprintf(...))",{"type":38,"tag":91,"props":408,"children":409},{},[410,416,418,424,425,431,433],{"type":38,"tag":60,"props":411,"children":413},{"className":412},[],[414],{"type":44,"value":415},"atomic.Bool",{"type":44,"value":417},"\u002F",{"type":38,"tag":60,"props":419,"children":421},{"className":420},[],[422],{"type":44,"value":423},"atomic.Int64",{"type":44,"value":417},{"type":38,"tag":60,"props":426,"children":428},{"className":427},[],[429],{"type":44,"value":430},"atomic.Pointer[T]",{"type":44,"value":432},": Type-safe atomics instead of ",{"type":38,"tag":60,"props":434,"children":436},{"className":435},[],[437],{"type":44,"value":438},"atomic.StoreInt32",{"type":38,"tag":440,"props":441,"children":445},"pre",{"className":442,"code":443,"language":21,"meta":444,"style":444},"language-go shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","var flag atomic.Bool\nflag.Store(true)\nif flag.Load() { ... }\n\nvar ptr atomic.Pointer[Config]\nptr.Store(cfg)\n","",[446],{"type":38,"tag":60,"props":447,"children":448},{"__ignoreMap":444},[449,459,468,477,487,496],{"type":38,"tag":123,"props":450,"children":453},{"class":451,"line":452},"line",1,[454],{"type":38,"tag":123,"props":455,"children":456},{},[457],{"type":44,"value":458},"var flag atomic.Bool\n",{"type":38,"tag":123,"props":460,"children":462},{"class":451,"line":461},2,[463],{"type":38,"tag":123,"props":464,"children":465},{},[466],{"type":44,"value":467},"flag.Store(true)\n",{"type":38,"tag":123,"props":469,"children":471},{"class":451,"line":470},3,[472],{"type":38,"tag":123,"props":473,"children":474},{},[475],{"type":44,"value":476},"if flag.Load() { ... }\n",{"type":38,"tag":123,"props":478,"children":480},{"class":451,"line":479},4,[481],{"type":38,"tag":123,"props":482,"children":484},{"emptyLinePlaceholder":483},true,[485],{"type":44,"value":486},"\n",{"type":38,"tag":123,"props":488,"children":490},{"class":451,"line":489},5,[491],{"type":38,"tag":123,"props":492,"children":493},{},[494],{"type":44,"value":495},"var ptr atomic.Pointer[Config]\n",{"type":38,"tag":123,"props":497,"children":499},{"class":451,"line":498},6,[500],{"type":38,"tag":123,"props":501,"children":502},{},[503],{"type":44,"value":504},"ptr.Store(cfg)\n",{"type":38,"tag":209,"props":506,"children":508},{"id":507},"go-120",[509],{"type":44,"value":510},"Go 1.20+",{"type":38,"tag":87,"props":512,"children":513},{},[514,532,550,566,584,608],{"type":38,"tag":91,"props":515,"children":516},{},[517,523,524,530],{"type":38,"tag":60,"props":518,"children":520},{"className":519},[],[521],{"type":44,"value":522},"strings.Clone",{"type":44,"value":228},{"type":38,"tag":60,"props":525,"children":527},{"className":526},[],[528],{"type":44,"value":529},"strings.Clone(s)",{"type":44,"value":531}," to copy string without sharing memory",{"type":38,"tag":91,"props":533,"children":534},{},[535,541,542,548],{"type":38,"tag":60,"props":536,"children":538},{"className":537},[],[539],{"type":44,"value":540},"bytes.Clone",{"type":44,"value":228},{"type":38,"tag":60,"props":543,"children":545},{"className":544},[],[546],{"type":44,"value":547},"bytes.Clone(b)",{"type":44,"value":549}," to copy byte slice",{"type":38,"tag":91,"props":551,"children":552},{},[553,559,560],{"type":38,"tag":60,"props":554,"children":556},{"className":555},[],[557],{"type":44,"value":558},"strings.CutPrefix\u002FCutSuffix",{"type":44,"value":228},{"type":38,"tag":60,"props":561,"children":563},{"className":562},[],[564],{"type":44,"value":565},"if rest, ok := strings.CutPrefix(s, \"pre:\"); ok { ... }",{"type":38,"tag":91,"props":567,"children":568},{},[569,575,576,582],{"type":38,"tag":60,"props":570,"children":572},{"className":571},[],[573],{"type":44,"value":574},"errors.Join",{"type":44,"value":228},{"type":38,"tag":60,"props":577,"children":579},{"className":578},[],[580],{"type":44,"value":581},"errors.Join(err1, err2)",{"type":44,"value":583}," to combine multiple errors",{"type":38,"tag":91,"props":585,"children":586},{},[587,593,594,600,602],{"type":38,"tag":60,"props":588,"children":590},{"className":589},[],[591],{"type":44,"value":592},"context.WithCancelCause",{"type":44,"value":228},{"type":38,"tag":60,"props":595,"children":597},{"className":596},[],[598],{"type":44,"value":599},"ctx, cancel := context.WithCancelCause(parent)",{"type":44,"value":601}," then ",{"type":38,"tag":60,"props":603,"children":605},{"className":604},[],[606],{"type":44,"value":607},"cancel(err)",{"type":38,"tag":91,"props":609,"children":610},{},[611,617,618,624],{"type":38,"tag":60,"props":612,"children":614},{"className":613},[],[615],{"type":44,"value":616},"context.Cause",{"type":44,"value":228},{"type":38,"tag":60,"props":619,"children":621},{"className":620},[],[622],{"type":44,"value":623},"context.Cause(ctx)",{"type":44,"value":625}," to get the error that caused cancellation",{"type":38,"tag":209,"props":627,"children":629},{"id":628},"go-121",[630],{"type":44,"value":631},"Go 1.21+",{"type":38,"tag":54,"props":633,"children":634},{},[635],{"type":38,"tag":81,"props":636,"children":637},{},[638],{"type":44,"value":639},"Built-ins:",{"type":38,"tag":87,"props":641,"children":642},{},[643,668],{"type":38,"tag":91,"props":644,"children":645},{},[646,652,653,659,660,666],{"type":38,"tag":60,"props":647,"children":649},{"className":648},[],[650],{"type":44,"value":651},"min",{"type":44,"value":417},{"type":38,"tag":60,"props":654,"children":656},{"className":655},[],[657],{"type":44,"value":658},"max",{"type":44,"value":228},{"type":38,"tag":60,"props":661,"children":663},{"className":662},[],[664],{"type":44,"value":665},"max(a, b)",{"type":44,"value":667}," instead of if\u002Felse comparisons",{"type":38,"tag":91,"props":669,"children":670},{},[671,677,678,684,686,692],{"type":38,"tag":60,"props":672,"children":674},{"className":673},[],[675],{"type":44,"value":676},"clear",{"type":44,"value":228},{"type":38,"tag":60,"props":679,"children":681},{"className":680},[],[682],{"type":44,"value":683},"clear(m)",{"type":44,"value":685}," to delete all map entries, ",{"type":38,"tag":60,"props":687,"children":689},{"className":688},[],[690],{"type":44,"value":691},"clear(s)",{"type":44,"value":693}," to zero slice elements",{"type":38,"tag":54,"props":695,"children":696},{},[697],{"type":38,"tag":81,"props":698,"children":699},{},[700],{"type":44,"value":701},"slices package:",{"type":38,"tag":87,"props":703,"children":704},{},[705,723,741,757,773,791,816,834,852,870],{"type":38,"tag":91,"props":706,"children":707},{},[708,714,715,721],{"type":38,"tag":60,"props":709,"children":711},{"className":710},[],[712],{"type":44,"value":713},"slices.Contains",{"type":44,"value":228},{"type":38,"tag":60,"props":716,"children":718},{"className":717},[],[719],{"type":44,"value":720},"slices.Contains(items, x)",{"type":44,"value":722}," instead of manual loops",{"type":38,"tag":91,"props":724,"children":725},{},[726,732,733,739],{"type":38,"tag":60,"props":727,"children":729},{"className":728},[],[730],{"type":44,"value":731},"slices.Index",{"type":44,"value":228},{"type":38,"tag":60,"props":734,"children":736},{"className":735},[],[737],{"type":44,"value":738},"slices.Index(items, x)",{"type":44,"value":740}," returns index (-1 if not found)",{"type":38,"tag":91,"props":742,"children":743},{},[744,750,751],{"type":38,"tag":60,"props":745,"children":747},{"className":746},[],[748],{"type":44,"value":749},"slices.IndexFunc",{"type":44,"value":228},{"type":38,"tag":60,"props":752,"children":754},{"className":753},[],[755],{"type":44,"value":756},"slices.IndexFunc(items, func(item T) bool { return item.ID == id })",{"type":38,"tag":91,"props":758,"children":759},{},[760,766,767],{"type":38,"tag":60,"props":761,"children":763},{"className":762},[],[764],{"type":44,"value":765},"slices.SortFunc",{"type":44,"value":228},{"type":38,"tag":60,"props":768,"children":770},{"className":769},[],[771],{"type":44,"value":772},"slices.SortFunc(items, func(a, b T) int { return cmp.Compare(a.X, b.X) })",{"type":38,"tag":91,"props":774,"children":775},{},[776,782,783,789],{"type":38,"tag":60,"props":777,"children":779},{"className":778},[],[780],{"type":44,"value":781},"slices.Sort",{"type":44,"value":228},{"type":38,"tag":60,"props":784,"children":786},{"className":785},[],[787],{"type":44,"value":788},"slices.Sort(items)",{"type":44,"value":790}," for ordered types",{"type":38,"tag":91,"props":792,"children":793},{},[794,800,801,807,808,814],{"type":38,"tag":60,"props":795,"children":797},{"className":796},[],[798],{"type":44,"value":799},"slices.Max",{"type":44,"value":417},{"type":38,"tag":60,"props":802,"children":804},{"className":803},[],[805],{"type":44,"value":806},"slices.Min",{"type":44,"value":228},{"type":38,"tag":60,"props":809,"children":811},{"className":810},[],[812],{"type":44,"value":813},"slices.Max(items)",{"type":44,"value":815}," instead of manual loop",{"type":38,"tag":91,"props":817,"children":818},{},[819,825,826,832],{"type":38,"tag":60,"props":820,"children":822},{"className":821},[],[823],{"type":44,"value":824},"slices.Reverse",{"type":44,"value":228},{"type":38,"tag":60,"props":827,"children":829},{"className":828},[],[830],{"type":44,"value":831},"slices.Reverse(items)",{"type":44,"value":833}," instead of manual swap loop",{"type":38,"tag":91,"props":835,"children":836},{},[837,843,844,850],{"type":38,"tag":60,"props":838,"children":840},{"className":839},[],[841],{"type":44,"value":842},"slices.Compact",{"type":44,"value":228},{"type":38,"tag":60,"props":845,"children":847},{"className":846},[],[848],{"type":44,"value":849},"slices.Compact(items)",{"type":44,"value":851}," removes consecutive duplicates in-place",{"type":38,"tag":91,"props":853,"children":854},{},[855,861,862,868],{"type":38,"tag":60,"props":856,"children":858},{"className":857},[],[859],{"type":44,"value":860},"slices.Clip",{"type":44,"value":228},{"type":38,"tag":60,"props":863,"children":865},{"className":864},[],[866],{"type":44,"value":867},"slices.Clip(s)",{"type":44,"value":869}," removes unused capacity",{"type":38,"tag":91,"props":871,"children":872},{},[873,879,880,886],{"type":38,"tag":60,"props":874,"children":876},{"className":875},[],[877],{"type":44,"value":878},"slices.Clone",{"type":44,"value":228},{"type":38,"tag":60,"props":881,"children":883},{"className":882},[],[884],{"type":44,"value":885},"slices.Clone(s)",{"type":44,"value":887}," creates a copy",{"type":38,"tag":54,"props":889,"children":890},{},[891],{"type":38,"tag":81,"props":892,"children":893},{},[894],{"type":44,"value":895},"maps package:",{"type":38,"tag":87,"props":897,"children":898},{},[899,917,935],{"type":38,"tag":91,"props":900,"children":901},{},[902,908,909,915],{"type":38,"tag":60,"props":903,"children":905},{"className":904},[],[906],{"type":44,"value":907},"maps.Clone",{"type":44,"value":228},{"type":38,"tag":60,"props":910,"children":912},{"className":911},[],[913],{"type":44,"value":914},"maps.Clone(m)",{"type":44,"value":916}," instead of manual map iteration",{"type":38,"tag":91,"props":918,"children":919},{},[920,926,927,933],{"type":38,"tag":60,"props":921,"children":923},{"className":922},[],[924],{"type":44,"value":925},"maps.Copy",{"type":44,"value":228},{"type":38,"tag":60,"props":928,"children":930},{"className":929},[],[931],{"type":44,"value":932},"maps.Copy(dst, src)",{"type":44,"value":934}," copies entries from src to dst",{"type":38,"tag":91,"props":936,"children":937},{},[938,944,945],{"type":38,"tag":60,"props":939,"children":941},{"className":940},[],[942],{"type":44,"value":943},"maps.DeleteFunc",{"type":44,"value":228},{"type":38,"tag":60,"props":946,"children":948},{"className":947},[],[949],{"type":44,"value":950},"maps.DeleteFunc(m, func(k K, v V) bool { return condition })",{"type":38,"tag":54,"props":952,"children":953},{},[954],{"type":38,"tag":81,"props":955,"children":956},{},[957],{"type":44,"value":958},"sync package:",{"type":38,"tag":87,"props":960,"children":961},{},[962,987],{"type":38,"tag":91,"props":963,"children":964},{},[965,971,972,978,979,985],{"type":38,"tag":60,"props":966,"children":968},{"className":967},[],[969],{"type":44,"value":970},"sync.OnceFunc",{"type":44,"value":228},{"type":38,"tag":60,"props":973,"children":975},{"className":974},[],[976],{"type":44,"value":977},"f := sync.OnceFunc(func() { ... })",{"type":44,"value":236},{"type":38,"tag":60,"props":980,"children":982},{"className":981},[],[983],{"type":44,"value":984},"sync.Once",{"type":44,"value":986}," + wrapper",{"type":38,"tag":91,"props":988,"children":989},{},[990,996,997],{"type":38,"tag":60,"props":991,"children":993},{"className":992},[],[994],{"type":44,"value":995},"sync.OnceValue",{"type":44,"value":228},{"type":38,"tag":60,"props":998,"children":1000},{"className":999},[],[1001],{"type":44,"value":1002},"getter := sync.OnceValue(func() T { return computeValue() })",{"type":38,"tag":54,"props":1004,"children":1005},{},[1006],{"type":38,"tag":81,"props":1007,"children":1008},{},[1009],{"type":44,"value":1010},"context package:",{"type":38,"tag":87,"props":1012,"children":1013},{},[1014,1032,1048],{"type":38,"tag":91,"props":1015,"children":1016},{},[1017,1023,1024,1030],{"type":38,"tag":60,"props":1018,"children":1020},{"className":1019},[],[1021],{"type":44,"value":1022},"context.AfterFunc",{"type":44,"value":228},{"type":38,"tag":60,"props":1025,"children":1027},{"className":1026},[],[1028],{"type":44,"value":1029},"stop := context.AfterFunc(ctx, cleanup)",{"type":44,"value":1031}," runs cleanup on cancellation",{"type":38,"tag":91,"props":1033,"children":1034},{},[1035,1041,1042],{"type":38,"tag":60,"props":1036,"children":1038},{"className":1037},[],[1039],{"type":44,"value":1040},"context.WithTimeoutCause",{"type":44,"value":228},{"type":38,"tag":60,"props":1043,"children":1045},{"className":1044},[],[1046],{"type":44,"value":1047},"ctx, cancel := context.WithTimeoutCause(parent, d, err)",{"type":38,"tag":91,"props":1049,"children":1050},{},[1051,1057],{"type":38,"tag":60,"props":1052,"children":1054},{"className":1053},[],[1055],{"type":44,"value":1056},"context.WithDeadlineCause",{"type":44,"value":1058},": Similar with deadline instead of duration",{"type":38,"tag":209,"props":1060,"children":1062},{"id":1061},"go-122",[1063],{"type":44,"value":1064},"Go 1.22+",{"type":38,"tag":54,"props":1066,"children":1067},{},[1068],{"type":38,"tag":81,"props":1069,"children":1070},{},[1071],{"type":44,"value":1072},"Loops:",{"type":38,"tag":87,"props":1074,"children":1075},{},[1076,1099],{"type":38,"tag":91,"props":1077,"children":1078},{},[1079,1085,1086,1092,1093],{"type":38,"tag":60,"props":1080,"children":1082},{"className":1081},[],[1083],{"type":44,"value":1084},"for i := range n",{"type":44,"value":228},{"type":38,"tag":60,"props":1087,"children":1089},{"className":1088},[],[1090],{"type":44,"value":1091},"for i := range len(items)",{"type":44,"value":236},{"type":38,"tag":60,"props":1094,"children":1096},{"className":1095},[],[1097],{"type":44,"value":1098},"for i := 0; i \u003C len(items); i++",{"type":38,"tag":91,"props":1100,"children":1101},{},[1102],{"type":44,"value":1103},"Loop variables are now safe to capture in goroutines (each iteration has its own copy)",{"type":38,"tag":54,"props":1105,"children":1106},{},[1107],{"type":38,"tag":81,"props":1108,"children":1109},{},[1110],{"type":44,"value":1111},"cmp package:",{"type":38,"tag":87,"props":1113,"children":1114},{},[1115],{"type":38,"tag":91,"props":1116,"children":1117},{},[1118,1124,1125,1131],{"type":38,"tag":60,"props":1119,"children":1121},{"className":1120},[],[1122],{"type":44,"value":1123},"cmp.Or",{"type":44,"value":228},{"type":38,"tag":60,"props":1126,"children":1128},{"className":1127},[],[1129],{"type":44,"value":1130},"cmp.Or(flag, env, config, \"default\")",{"type":44,"value":1132}," returns first non-zero value",{"type":38,"tag":440,"props":1134,"children":1136},{"className":442,"code":1135,"language":21,"meta":444,"style":444},"\u002F\u002F Instead of:\nname := os.Getenv(\"NAME\")\nif name == \"\" {\n    name = \"default\"\n}\n\u002F\u002F Use:\nname := cmp.Or(os.Getenv(\"NAME\"), \"default\")\n",[1137],{"type":38,"tag":60,"props":1138,"children":1139},{"__ignoreMap":444},[1140,1148,1156,1164,1172,1180,1188],{"type":38,"tag":123,"props":1141,"children":1142},{"class":451,"line":452},[1143],{"type":38,"tag":123,"props":1144,"children":1145},{},[1146],{"type":44,"value":1147},"\u002F\u002F Instead of:\n",{"type":38,"tag":123,"props":1149,"children":1150},{"class":451,"line":461},[1151],{"type":38,"tag":123,"props":1152,"children":1153},{},[1154],{"type":44,"value":1155},"name := os.Getenv(\"NAME\")\n",{"type":38,"tag":123,"props":1157,"children":1158},{"class":451,"line":470},[1159],{"type":38,"tag":123,"props":1160,"children":1161},{},[1162],{"type":44,"value":1163},"if name == \"\" {\n",{"type":38,"tag":123,"props":1165,"children":1166},{"class":451,"line":479},[1167],{"type":38,"tag":123,"props":1168,"children":1169},{},[1170],{"type":44,"value":1171},"    name = \"default\"\n",{"type":38,"tag":123,"props":1173,"children":1174},{"class":451,"line":489},[1175],{"type":38,"tag":123,"props":1176,"children":1177},{},[1178],{"type":44,"value":1179},"}\n",{"type":38,"tag":123,"props":1181,"children":1182},{"class":451,"line":498},[1183],{"type":38,"tag":123,"props":1184,"children":1185},{},[1186],{"type":44,"value":1187},"\u002F\u002F Use:\n",{"type":38,"tag":123,"props":1189,"children":1191},{"class":451,"line":1190},7,[1192],{"type":38,"tag":123,"props":1193,"children":1194},{},[1195],{"type":44,"value":1196},"name := cmp.Or(os.Getenv(\"NAME\"), \"default\")\n",{"type":38,"tag":54,"props":1198,"children":1199},{},[1200],{"type":38,"tag":81,"props":1201,"children":1202},{},[1203],{"type":44,"value":1204},"reflect package:",{"type":38,"tag":87,"props":1206,"children":1207},{},[1208],{"type":38,"tag":91,"props":1209,"children":1210},{},[1211,1217,1218,1224,1225],{"type":38,"tag":60,"props":1212,"children":1214},{"className":1213},[],[1215],{"type":44,"value":1216},"reflect.TypeFor",{"type":44,"value":228},{"type":38,"tag":60,"props":1219,"children":1221},{"className":1220},[],[1222],{"type":44,"value":1223},"reflect.TypeFor[T]()",{"type":44,"value":236},{"type":38,"tag":60,"props":1226,"children":1228},{"className":1227},[],[1229],{"type":44,"value":1230},"reflect.TypeOf((*T)(nil)).Elem()",{"type":38,"tag":54,"props":1232,"children":1233},{},[1234],{"type":38,"tag":81,"props":1235,"children":1236},{},[1237],{"type":44,"value":1238},"net\u002Fhttp:",{"type":38,"tag":87,"props":1240,"children":1241},{},[1242,1263],{"type":38,"tag":91,"props":1243,"children":1244},{},[1245,1247,1253,1255,1261],{"type":44,"value":1246},"Enhanced ",{"type":38,"tag":60,"props":1248,"children":1250},{"className":1249},[],[1251],{"type":44,"value":1252},"http.ServeMux",{"type":44,"value":1254}," patterns: ",{"type":38,"tag":60,"props":1256,"children":1258},{"className":1257},[],[1259],{"type":44,"value":1260},"mux.HandleFunc(\"GET \u002Fapi\u002F{id}\", handler)",{"type":44,"value":1262}," with method and path params",{"type":38,"tag":91,"props":1264,"children":1265},{},[1266,1272],{"type":38,"tag":60,"props":1267,"children":1269},{"className":1268},[],[1270],{"type":44,"value":1271},"r.PathValue(\"id\")",{"type":44,"value":1273}," to get path parameters",{"type":38,"tag":209,"props":1275,"children":1277},{"id":1276},"go-123",[1278],{"type":44,"value":1279},"Go 1.23+",{"type":38,"tag":87,"props":1281,"children":1282},{},[1283,1301,1312],{"type":38,"tag":91,"props":1284,"children":1285},{},[1286,1292,1293,1299],{"type":38,"tag":60,"props":1287,"children":1289},{"className":1288},[],[1290],{"type":44,"value":1291},"maps.Keys(m)",{"type":44,"value":129},{"type":38,"tag":60,"props":1294,"children":1296},{"className":1295},[],[1297],{"type":44,"value":1298},"maps.Values(m)",{"type":44,"value":1300}," return iterators",{"type":38,"tag":91,"props":1302,"children":1303},{},[1304,1310],{"type":38,"tag":60,"props":1305,"children":1307},{"className":1306},[],[1308],{"type":44,"value":1309},"slices.Collect(iter)",{"type":44,"value":1311}," not manual loop to build slice from iterator",{"type":38,"tag":91,"props":1313,"children":1314},{},[1315,1321],{"type":38,"tag":60,"props":1316,"children":1318},{"className":1317},[],[1319],{"type":44,"value":1320},"slices.Sorted(iter)",{"type":44,"value":1322}," to collect and sort in one step",{"type":38,"tag":440,"props":1324,"children":1326},{"className":442,"code":1325,"language":21,"meta":444,"style":444},"keys := slices.Collect(maps.Keys(m))       \u002F\u002F not: for k := range m { keys = append(keys, k) }\nsortedKeys := slices.Sorted(maps.Keys(m))  \u002F\u002F collect + sort\nfor k := range maps.Keys(m) { process(k) } \u002F\u002F iterate directly\n",[1327],{"type":38,"tag":60,"props":1328,"children":1329},{"__ignoreMap":444},[1330,1338,1346],{"type":38,"tag":123,"props":1331,"children":1332},{"class":451,"line":452},[1333],{"type":38,"tag":123,"props":1334,"children":1335},{},[1336],{"type":44,"value":1337},"keys := slices.Collect(maps.Keys(m))       \u002F\u002F not: for k := range m { keys = append(keys, k) }\n",{"type":38,"tag":123,"props":1339,"children":1340},{"class":451,"line":461},[1341],{"type":38,"tag":123,"props":1342,"children":1343},{},[1344],{"type":44,"value":1345},"sortedKeys := slices.Sorted(maps.Keys(m))  \u002F\u002F collect + sort\n",{"type":38,"tag":123,"props":1347,"children":1348},{"class":451,"line":470},[1349],{"type":38,"tag":123,"props":1350,"children":1351},{},[1352],{"type":44,"value":1353},"for k := range maps.Keys(m) { process(k) } \u002F\u002F iterate directly\n",{"type":38,"tag":54,"props":1355,"children":1356},{},[1357],{"type":38,"tag":81,"props":1358,"children":1359},{},[1360],{"type":44,"value":1361},"time package",{"type":38,"tag":87,"props":1363,"children":1364},{},[1365],{"type":38,"tag":91,"props":1366,"children":1367},{},[1368,1374,1375,1380],{"type":38,"tag":60,"props":1369,"children":1371},{"className":1370},[],[1372],{"type":44,"value":1373},"time.Tick",{"type":44,"value":328},{"type":38,"tag":60,"props":1376,"children":1378},{"className":1377},[],[1379],{"type":44,"value":1373},{"type":44,"value":1381}," freely — as of Go 1.23, the garbage collector can recover unreferenced tickers, even if they haven't been stopped. The Stop method is no longer necessary to help the garbage collector. There is no longer any reason to prefer NewTicker when Tick will do.",{"type":38,"tag":209,"props":1383,"children":1385},{"id":1384},"go-124",[1386],{"type":44,"value":1387},"Go 1.24+",{"type":38,"tag":87,"props":1389,"children":1390},{},[1391],{"type":38,"tag":91,"props":1392,"children":1393},{},[1394,1400,1402,1408],{"type":38,"tag":60,"props":1395,"children":1397},{"className":1396},[],[1398],{"type":44,"value":1399},"t.Context()",{"type":44,"value":1401}," not ",{"type":38,"tag":60,"props":1403,"children":1405},{"className":1404},[],[1406],{"type":44,"value":1407},"context.WithCancel(context.Background())",{"type":44,"value":1409}," in tests.\nALWAYS use t.Context() when a test function needs a context.",{"type":38,"tag":54,"props":1411,"children":1412},{},[1413],{"type":44,"value":1414},"Before:",{"type":38,"tag":440,"props":1416,"children":1418},{"className":442,"code":1417,"language":21,"meta":444,"style":444},"func TestFoo(t *testing.T) {\n    ctx, cancel := context.WithCancel(context.Background())\n    defer cancel()\n    result := doSomething(ctx)\n}\n",[1419],{"type":38,"tag":60,"props":1420,"children":1421},{"__ignoreMap":444},[1422,1430,1438,1446,1454],{"type":38,"tag":123,"props":1423,"children":1424},{"class":451,"line":452},[1425],{"type":38,"tag":123,"props":1426,"children":1427},{},[1428],{"type":44,"value":1429},"func TestFoo(t *testing.T) {\n",{"type":38,"tag":123,"props":1431,"children":1432},{"class":451,"line":461},[1433],{"type":38,"tag":123,"props":1434,"children":1435},{},[1436],{"type":44,"value":1437},"    ctx, cancel := context.WithCancel(context.Background())\n",{"type":38,"tag":123,"props":1439,"children":1440},{"class":451,"line":470},[1441],{"type":38,"tag":123,"props":1442,"children":1443},{},[1444],{"type":44,"value":1445},"    defer cancel()\n",{"type":38,"tag":123,"props":1447,"children":1448},{"class":451,"line":479},[1449],{"type":38,"tag":123,"props":1450,"children":1451},{},[1452],{"type":44,"value":1453},"    result := doSomething(ctx)\n",{"type":38,"tag":123,"props":1455,"children":1456},{"class":451,"line":489},[1457],{"type":38,"tag":123,"props":1458,"children":1459},{},[1460],{"type":44,"value":1179},{"type":38,"tag":54,"props":1462,"children":1463},{},[1464],{"type":44,"value":1465},"After:",{"type":38,"tag":440,"props":1467,"children":1469},{"className":442,"code":1468,"language":21,"meta":444,"style":444},"func TestFoo(t *testing.T) {\n    ctx := t.Context()\n    result := doSomething(ctx)\n}\n",[1470],{"type":38,"tag":60,"props":1471,"children":1472},{"__ignoreMap":444},[1473,1480,1488,1495],{"type":38,"tag":123,"props":1474,"children":1475},{"class":451,"line":452},[1476],{"type":38,"tag":123,"props":1477,"children":1478},{},[1479],{"type":44,"value":1429},{"type":38,"tag":123,"props":1481,"children":1482},{"class":451,"line":461},[1483],{"type":38,"tag":123,"props":1484,"children":1485},{},[1486],{"type":44,"value":1487},"    ctx := t.Context()\n",{"type":38,"tag":123,"props":1489,"children":1490},{"class":451,"line":470},[1491],{"type":38,"tag":123,"props":1492,"children":1493},{},[1494],{"type":44,"value":1453},{"type":38,"tag":123,"props":1496,"children":1497},{"class":451,"line":479},[1498],{"type":38,"tag":123,"props":1499,"children":1500},{},[1501],{"type":44,"value":1179},{"type":38,"tag":87,"props":1503,"children":1504},{},[1505],{"type":38,"tag":91,"props":1506,"children":1507},{},[1508,1514,1515,1521],{"type":38,"tag":60,"props":1509,"children":1511},{"className":1510},[],[1512],{"type":44,"value":1513},"omitzero",{"type":44,"value":1401},{"type":38,"tag":60,"props":1516,"children":1518},{"className":1517},[],[1519],{"type":44,"value":1520},"omitempty",{"type":44,"value":1522}," in JSON struct tags.\nALWAYS use omitzero for time.Duration, time.Time, structs, slices, maps.",{"type":38,"tag":54,"props":1524,"children":1525},{},[1526],{"type":44,"value":1414},{"type":38,"tag":440,"props":1528,"children":1530},{"className":442,"code":1529,"language":21,"meta":444,"style":444},"type Config struct {\n    Timeout time.Duration `json:\"timeout,omitempty\"` \u002F\u002F doesn't work for Duration!\n}\n",[1531],{"type":38,"tag":60,"props":1532,"children":1533},{"__ignoreMap":444},[1534,1542,1550],{"type":38,"tag":123,"props":1535,"children":1536},{"class":451,"line":452},[1537],{"type":38,"tag":123,"props":1538,"children":1539},{},[1540],{"type":44,"value":1541},"type Config struct {\n",{"type":38,"tag":123,"props":1543,"children":1544},{"class":451,"line":461},[1545],{"type":38,"tag":123,"props":1546,"children":1547},{},[1548],{"type":44,"value":1549},"    Timeout time.Duration `json:\"timeout,omitempty\"` \u002F\u002F doesn't work for Duration!\n",{"type":38,"tag":123,"props":1551,"children":1552},{"class":451,"line":470},[1553],{"type":38,"tag":123,"props":1554,"children":1555},{},[1556],{"type":44,"value":1179},{"type":38,"tag":54,"props":1558,"children":1559},{},[1560],{"type":44,"value":1465},{"type":38,"tag":440,"props":1562,"children":1564},{"className":442,"code":1563,"language":21,"meta":444,"style":444},"type Config struct {\n    Timeout time.Duration `json:\"timeout,omitzero\"`\n}\n",[1565],{"type":38,"tag":60,"props":1566,"children":1567},{"__ignoreMap":444},[1568,1575,1583],{"type":38,"tag":123,"props":1569,"children":1570},{"class":451,"line":452},[1571],{"type":38,"tag":123,"props":1572,"children":1573},{},[1574],{"type":44,"value":1541},{"type":38,"tag":123,"props":1576,"children":1577},{"class":451,"line":461},[1578],{"type":38,"tag":123,"props":1579,"children":1580},{},[1581],{"type":44,"value":1582},"    Timeout time.Duration `json:\"timeout,omitzero\"`\n",{"type":38,"tag":123,"props":1584,"children":1585},{"class":451,"line":470},[1586],{"type":38,"tag":123,"props":1587,"children":1588},{},[1589],{"type":44,"value":1179},{"type":38,"tag":87,"props":1591,"children":1592},{},[1593],{"type":38,"tag":91,"props":1594,"children":1595},{},[1596,1602,1603,1609],{"type":38,"tag":60,"props":1597,"children":1599},{"className":1598},[],[1600],{"type":44,"value":1601},"b.Loop()",{"type":44,"value":1401},{"type":38,"tag":60,"props":1604,"children":1606},{"className":1605},[],[1607],{"type":44,"value":1608},"for i := 0; i \u003C b.N; i++",{"type":44,"value":1610}," in benchmarks.\nALWAYS use b.Loop() for the main loop in benchmark functions.",{"type":38,"tag":54,"props":1612,"children":1613},{},[1614],{"type":44,"value":1414},{"type":38,"tag":440,"props":1616,"children":1618},{"className":442,"code":1617,"language":21,"meta":444,"style":444},"func BenchmarkFoo(b *testing.B) {\n    for i := 0; i \u003C b.N; i++ {\n        doWork()\n    }\n}\n",[1619],{"type":38,"tag":60,"props":1620,"children":1621},{"__ignoreMap":444},[1622,1630,1638,1646,1654],{"type":38,"tag":123,"props":1623,"children":1624},{"class":451,"line":452},[1625],{"type":38,"tag":123,"props":1626,"children":1627},{},[1628],{"type":44,"value":1629},"func BenchmarkFoo(b *testing.B) {\n",{"type":38,"tag":123,"props":1631,"children":1632},{"class":451,"line":461},[1633],{"type":38,"tag":123,"props":1634,"children":1635},{},[1636],{"type":44,"value":1637},"    for i := 0; i \u003C b.N; i++ {\n",{"type":38,"tag":123,"props":1639,"children":1640},{"class":451,"line":470},[1641],{"type":38,"tag":123,"props":1642,"children":1643},{},[1644],{"type":44,"value":1645},"        doWork()\n",{"type":38,"tag":123,"props":1647,"children":1648},{"class":451,"line":479},[1649],{"type":38,"tag":123,"props":1650,"children":1651},{},[1652],{"type":44,"value":1653},"    }\n",{"type":38,"tag":123,"props":1655,"children":1656},{"class":451,"line":489},[1657],{"type":38,"tag":123,"props":1658,"children":1659},{},[1660],{"type":44,"value":1179},{"type":38,"tag":54,"props":1662,"children":1663},{},[1664],{"type":44,"value":1465},{"type":38,"tag":440,"props":1666,"children":1668},{"className":442,"code":1667,"language":21,"meta":444,"style":444},"func BenchmarkFoo(b *testing.B) {\n    for b.Loop() {\n        doWork()\n    }\n}\n",[1669],{"type":38,"tag":60,"props":1670,"children":1671},{"__ignoreMap":444},[1672,1679,1687,1694,1701],{"type":38,"tag":123,"props":1673,"children":1674},{"class":451,"line":452},[1675],{"type":38,"tag":123,"props":1676,"children":1677},{},[1678],{"type":44,"value":1629},{"type":38,"tag":123,"props":1680,"children":1681},{"class":451,"line":461},[1682],{"type":38,"tag":123,"props":1683,"children":1684},{},[1685],{"type":44,"value":1686},"    for b.Loop() {\n",{"type":38,"tag":123,"props":1688,"children":1689},{"class":451,"line":470},[1690],{"type":38,"tag":123,"props":1691,"children":1692},{},[1693],{"type":44,"value":1645},{"type":38,"tag":123,"props":1695,"children":1696},{"class":451,"line":479},[1697],{"type":38,"tag":123,"props":1698,"children":1699},{},[1700],{"type":44,"value":1653},{"type":38,"tag":123,"props":1702,"children":1703},{"class":451,"line":489},[1704],{"type":38,"tag":123,"props":1705,"children":1706},{},[1707],{"type":44,"value":1179},{"type":38,"tag":87,"props":1709,"children":1710},{},[1711],{"type":38,"tag":91,"props":1712,"children":1713},{},[1714,1720,1721,1727],{"type":38,"tag":60,"props":1715,"children":1717},{"className":1716},[],[1718],{"type":44,"value":1719},"strings.SplitSeq",{"type":44,"value":1401},{"type":38,"tag":60,"props":1722,"children":1724},{"className":1723},[],[1725],{"type":44,"value":1726},"strings.Split",{"type":44,"value":1728}," when iterating.\nALWAYS use SplitSeq\u002FFieldsSeq when iterating over split results in a for-range loop.",{"type":38,"tag":54,"props":1730,"children":1731},{},[1732],{"type":44,"value":1414},{"type":38,"tag":440,"props":1734,"children":1736},{"className":442,"code":1735,"language":21,"meta":444,"style":444},"for _, part := range strings.Split(s, \",\") {\n    process(part)\n}\n",[1737],{"type":38,"tag":60,"props":1738,"children":1739},{"__ignoreMap":444},[1740,1748,1756],{"type":38,"tag":123,"props":1741,"children":1742},{"class":451,"line":452},[1743],{"type":38,"tag":123,"props":1744,"children":1745},{},[1746],{"type":44,"value":1747},"for _, part := range strings.Split(s, \",\") {\n",{"type":38,"tag":123,"props":1749,"children":1750},{"class":451,"line":461},[1751],{"type":38,"tag":123,"props":1752,"children":1753},{},[1754],{"type":44,"value":1755},"    process(part)\n",{"type":38,"tag":123,"props":1757,"children":1758},{"class":451,"line":470},[1759],{"type":38,"tag":123,"props":1760,"children":1761},{},[1762],{"type":44,"value":1179},{"type":38,"tag":54,"props":1764,"children":1765},{},[1766],{"type":44,"value":1465},{"type":38,"tag":440,"props":1768,"children":1770},{"className":442,"code":1769,"language":21,"meta":444,"style":444},"for part := range strings.SplitSeq(s, \",\") {\n    process(part)\n}\n",[1771],{"type":38,"tag":60,"props":1772,"children":1773},{"__ignoreMap":444},[1774,1782,1789],{"type":38,"tag":123,"props":1775,"children":1776},{"class":451,"line":452},[1777],{"type":38,"tag":123,"props":1778,"children":1779},{},[1780],{"type":44,"value":1781},"for part := range strings.SplitSeq(s, \",\") {\n",{"type":38,"tag":123,"props":1783,"children":1784},{"class":451,"line":461},[1785],{"type":38,"tag":123,"props":1786,"children":1787},{},[1788],{"type":44,"value":1755},{"type":38,"tag":123,"props":1790,"children":1791},{"class":451,"line":470},[1792],{"type":38,"tag":123,"props":1793,"children":1794},{},[1795],{"type":44,"value":1179},{"type":38,"tag":54,"props":1797,"children":1798},{},[1799,1801,1807,1808,1814,1815,1821],{"type":44,"value":1800},"Also: ",{"type":38,"tag":60,"props":1802,"children":1804},{"className":1803},[],[1805],{"type":44,"value":1806},"strings.FieldsSeq",{"type":44,"value":172},{"type":38,"tag":60,"props":1809,"children":1811},{"className":1810},[],[1812],{"type":44,"value":1813},"bytes.SplitSeq",{"type":44,"value":172},{"type":38,"tag":60,"props":1816,"children":1818},{"className":1817},[],[1819],{"type":44,"value":1820},"bytes.FieldsSeq",{"type":44,"value":1822},".",{"type":38,"tag":209,"props":1824,"children":1826},{"id":1825},"go-125",[1827],{"type":44,"value":1828},"Go 1.25+",{"type":38,"tag":87,"props":1830,"children":1831},{},[1832],{"type":38,"tag":91,"props":1833,"children":1834},{},[1835,1841,1842,1848,1850,1856],{"type":38,"tag":60,"props":1836,"children":1838},{"className":1837},[],[1839],{"type":44,"value":1840},"wg.Go(fn)",{"type":44,"value":1401},{"type":38,"tag":60,"props":1843,"children":1845},{"className":1844},[],[1846],{"type":44,"value":1847},"wg.Add(1)",{"type":44,"value":1849}," + ",{"type":38,"tag":60,"props":1851,"children":1853},{"className":1852},[],[1854],{"type":44,"value":1855},"go func() { defer wg.Done(); ... }()",{"type":44,"value":1857},".\nALWAYS use wg.Go() when spawning goroutines with sync.WaitGroup.",{"type":38,"tag":54,"props":1859,"children":1860},{},[1861],{"type":44,"value":1414},{"type":38,"tag":440,"props":1863,"children":1865},{"className":442,"code":1864,"language":21,"meta":444,"style":444},"var wg sync.WaitGroup\nfor _, item := range items {\n    wg.Add(1)\n    go func() {\n        defer wg.Done()\n        process(item)\n    }()\n}\nwg.Wait()\n",[1866],{"type":38,"tag":60,"props":1867,"children":1868},{"__ignoreMap":444},[1869,1877,1885,1893,1901,1909,1917,1925,1933],{"type":38,"tag":123,"props":1870,"children":1871},{"class":451,"line":452},[1872],{"type":38,"tag":123,"props":1873,"children":1874},{},[1875],{"type":44,"value":1876},"var wg sync.WaitGroup\n",{"type":38,"tag":123,"props":1878,"children":1879},{"class":451,"line":461},[1880],{"type":38,"tag":123,"props":1881,"children":1882},{},[1883],{"type":44,"value":1884},"for _, item := range items {\n",{"type":38,"tag":123,"props":1886,"children":1887},{"class":451,"line":470},[1888],{"type":38,"tag":123,"props":1889,"children":1890},{},[1891],{"type":44,"value":1892},"    wg.Add(1)\n",{"type":38,"tag":123,"props":1894,"children":1895},{"class":451,"line":479},[1896],{"type":38,"tag":123,"props":1897,"children":1898},{},[1899],{"type":44,"value":1900},"    go func() {\n",{"type":38,"tag":123,"props":1902,"children":1903},{"class":451,"line":489},[1904],{"type":38,"tag":123,"props":1905,"children":1906},{},[1907],{"type":44,"value":1908},"        defer wg.Done()\n",{"type":38,"tag":123,"props":1910,"children":1911},{"class":451,"line":498},[1912],{"type":38,"tag":123,"props":1913,"children":1914},{},[1915],{"type":44,"value":1916},"        process(item)\n",{"type":38,"tag":123,"props":1918,"children":1919},{"class":451,"line":1190},[1920],{"type":38,"tag":123,"props":1921,"children":1922},{},[1923],{"type":44,"value":1924},"    }()\n",{"type":38,"tag":123,"props":1926,"children":1928},{"class":451,"line":1927},8,[1929],{"type":38,"tag":123,"props":1930,"children":1931},{},[1932],{"type":44,"value":1179},{"type":38,"tag":123,"props":1934,"children":1936},{"class":451,"line":1935},9,[1937],{"type":38,"tag":123,"props":1938,"children":1939},{},[1940],{"type":44,"value":1941},"wg.Wait()\n",{"type":38,"tag":54,"props":1943,"children":1944},{},[1945],{"type":44,"value":1465},{"type":38,"tag":440,"props":1947,"children":1949},{"className":442,"code":1948,"language":21,"meta":444,"style":444},"var wg sync.WaitGroup\nfor _, item := range items {\n    wg.Go(func() {\n        process(item)\n    })\n}\nwg.Wait()\n",[1950],{"type":38,"tag":60,"props":1951,"children":1952},{"__ignoreMap":444},[1953,1960,1967,1975,1982,1990,1997],{"type":38,"tag":123,"props":1954,"children":1955},{"class":451,"line":452},[1956],{"type":38,"tag":123,"props":1957,"children":1958},{},[1959],{"type":44,"value":1876},{"type":38,"tag":123,"props":1961,"children":1962},{"class":451,"line":461},[1963],{"type":38,"tag":123,"props":1964,"children":1965},{},[1966],{"type":44,"value":1884},{"type":38,"tag":123,"props":1968,"children":1969},{"class":451,"line":470},[1970],{"type":38,"tag":123,"props":1971,"children":1972},{},[1973],{"type":44,"value":1974},"    wg.Go(func() {\n",{"type":38,"tag":123,"props":1976,"children":1977},{"class":451,"line":479},[1978],{"type":38,"tag":123,"props":1979,"children":1980},{},[1981],{"type":44,"value":1916},{"type":38,"tag":123,"props":1983,"children":1984},{"class":451,"line":489},[1985],{"type":38,"tag":123,"props":1986,"children":1987},{},[1988],{"type":44,"value":1989},"    })\n",{"type":38,"tag":123,"props":1991,"children":1992},{"class":451,"line":498},[1993],{"type":38,"tag":123,"props":1994,"children":1995},{},[1996],{"type":44,"value":1179},{"type":38,"tag":123,"props":1998,"children":1999},{"class":451,"line":1190},[2000],{"type":38,"tag":123,"props":2001,"children":2002},{},[2003],{"type":44,"value":1941},{"type":38,"tag":209,"props":2005,"children":2007},{"id":2006},"go-126",[2008],{"type":44,"value":2009},"Go 1.26+",{"type":38,"tag":87,"props":2011,"children":2012},{},[2013],{"type":38,"tag":91,"props":2014,"children":2015},{},[2016,2022,2023,2029,2031,2036],{"type":38,"tag":60,"props":2017,"children":2019},{"className":2018},[],[2020],{"type":44,"value":2021},"new(val)",{"type":44,"value":1401},{"type":38,"tag":60,"props":2024,"children":2026},{"className":2025},[],[2027],{"type":44,"value":2028},"x := val; &x",{"type":44,"value":2030}," — returns pointer to any value.\nGo 1.26 extends new() to accept expressions, not just types.\nType is inferred: new(0) → *int, new(\"s\") → *string, new(T{}) → *T.\nDO NOT use ",{"type":38,"tag":60,"props":2032,"children":2034},{"className":2033},[],[2035],{"type":44,"value":2028},{"type":44,"value":2037}," pattern — always use new(val) directly.\nDO NOT use redundant casts like new(int(0)) — just write new(0).\nCommon use case: struct fields with pointer types.",{"type":38,"tag":54,"props":2039,"children":2040},{},[2041],{"type":44,"value":1414},{"type":38,"tag":440,"props":2043,"children":2045},{"className":442,"code":2044,"language":21,"meta":444,"style":444},"timeout := 30\ndebug := true\ncfg := Config{\n    Timeout: &timeout,\n    Debug:   &debug,\n}\n",[2046],{"type":38,"tag":60,"props":2047,"children":2048},{"__ignoreMap":444},[2049,2057,2065,2073,2081,2089],{"type":38,"tag":123,"props":2050,"children":2051},{"class":451,"line":452},[2052],{"type":38,"tag":123,"props":2053,"children":2054},{},[2055],{"type":44,"value":2056},"timeout := 30\n",{"type":38,"tag":123,"props":2058,"children":2059},{"class":451,"line":461},[2060],{"type":38,"tag":123,"props":2061,"children":2062},{},[2063],{"type":44,"value":2064},"debug := true\n",{"type":38,"tag":123,"props":2066,"children":2067},{"class":451,"line":470},[2068],{"type":38,"tag":123,"props":2069,"children":2070},{},[2071],{"type":44,"value":2072},"cfg := Config{\n",{"type":38,"tag":123,"props":2074,"children":2075},{"class":451,"line":479},[2076],{"type":38,"tag":123,"props":2077,"children":2078},{},[2079],{"type":44,"value":2080},"    Timeout: &timeout,\n",{"type":38,"tag":123,"props":2082,"children":2083},{"class":451,"line":489},[2084],{"type":38,"tag":123,"props":2085,"children":2086},{},[2087],{"type":44,"value":2088},"    Debug:   &debug,\n",{"type":38,"tag":123,"props":2090,"children":2091},{"class":451,"line":498},[2092],{"type":38,"tag":123,"props":2093,"children":2094},{},[2095],{"type":44,"value":1179},{"type":38,"tag":54,"props":2097,"children":2098},{},[2099],{"type":44,"value":1465},{"type":38,"tag":440,"props":2101,"children":2103},{"className":442,"code":2102,"language":21,"meta":444,"style":444},"cfg := Config{\n    Timeout: new(30),   \u002F\u002F *int\n    Debug:   new(true), \u002F\u002F *bool\n}\n",[2104],{"type":38,"tag":60,"props":2105,"children":2106},{"__ignoreMap":444},[2107,2114,2122,2130],{"type":38,"tag":123,"props":2108,"children":2109},{"class":451,"line":452},[2110],{"type":38,"tag":123,"props":2111,"children":2112},{},[2113],{"type":44,"value":2072},{"type":38,"tag":123,"props":2115,"children":2116},{"class":451,"line":461},[2117],{"type":38,"tag":123,"props":2118,"children":2119},{},[2120],{"type":44,"value":2121},"    Timeout: new(30),   \u002F\u002F *int\n",{"type":38,"tag":123,"props":2123,"children":2124},{"class":451,"line":470},[2125],{"type":38,"tag":123,"props":2126,"children":2127},{},[2128],{"type":44,"value":2129},"    Debug:   new(true), \u002F\u002F *bool\n",{"type":38,"tag":123,"props":2131,"children":2132},{"class":451,"line":479},[2133],{"type":38,"tag":123,"props":2134,"children":2135},{},[2136],{"type":44,"value":1179},{"type":38,"tag":87,"props":2138,"children":2139},{},[2140],{"type":38,"tag":91,"props":2141,"children":2142},{},[2143,2149,2150,2156],{"type":38,"tag":60,"props":2144,"children":2146},{"className":2145},[],[2147],{"type":44,"value":2148},"errors.AsType[T](err)",{"type":44,"value":1401},{"type":38,"tag":60,"props":2151,"children":2153},{"className":2152},[],[2154],{"type":44,"value":2155},"errors.As(err, &target)",{"type":44,"value":2157},".\nALWAYS use errors.AsType when checking if error matches a specific type.",{"type":38,"tag":54,"props":2159,"children":2160},{},[2161],{"type":44,"value":1414},{"type":38,"tag":440,"props":2163,"children":2165},{"className":442,"code":2164,"language":21,"meta":444,"style":444},"var pathErr *os.PathError\nif errors.As(err, &pathErr) {\n    handle(pathErr)\n}\n",[2166],{"type":38,"tag":60,"props":2167,"children":2168},{"__ignoreMap":444},[2169,2177,2185,2193],{"type":38,"tag":123,"props":2170,"children":2171},{"class":451,"line":452},[2172],{"type":38,"tag":123,"props":2173,"children":2174},{},[2175],{"type":44,"value":2176},"var pathErr *os.PathError\n",{"type":38,"tag":123,"props":2178,"children":2179},{"class":451,"line":461},[2180],{"type":38,"tag":123,"props":2181,"children":2182},{},[2183],{"type":44,"value":2184},"if errors.As(err, &pathErr) {\n",{"type":38,"tag":123,"props":2186,"children":2187},{"class":451,"line":470},[2188],{"type":38,"tag":123,"props":2189,"children":2190},{},[2191],{"type":44,"value":2192},"    handle(pathErr)\n",{"type":38,"tag":123,"props":2194,"children":2195},{"class":451,"line":479},[2196],{"type":38,"tag":123,"props":2197,"children":2198},{},[2199],{"type":44,"value":1179},{"type":38,"tag":54,"props":2201,"children":2202},{},[2203],{"type":44,"value":1465},{"type":38,"tag":440,"props":2205,"children":2207},{"className":442,"code":2206,"language":21,"meta":444,"style":444},"if pathErr, ok := errors.AsType[*os.PathError](err); ok {\n    handle(pathErr)\n}\n",[2208],{"type":38,"tag":60,"props":2209,"children":2210},{"__ignoreMap":444},[2211,2219,2226],{"type":38,"tag":123,"props":2212,"children":2213},{"class":451,"line":452},[2214],{"type":38,"tag":123,"props":2215,"children":2216},{},[2217],{"type":44,"value":2218},"if pathErr, ok := errors.AsType[*os.PathError](err); ok {\n",{"type":38,"tag":123,"props":2220,"children":2221},{"class":451,"line":461},[2222],{"type":38,"tag":123,"props":2223,"children":2224},{},[2225],{"type":44,"value":2192},{"type":38,"tag":123,"props":2227,"children":2228},{"class":451,"line":470},[2229],{"type":38,"tag":123,"props":2230,"children":2231},{},[2232],{"type":44,"value":1179},{"type":38,"tag":2234,"props":2235,"children":2236},"style",{},[2237],{"type":44,"value":2238},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2240,"total":452},[2241],{"slug":4,"name":4,"fn":5,"description":6,"org":2242,"tags":2243,"stars":22,"repoUrl":23,"updatedAt":24},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2244,2245,2246],{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"name":20,"slug":21,"type":15},{"items":2248,"total":2377},[2249,2265,2274,2283,2294,2304,2317,2326,2335,2345,2354,2367],{"slug":2250,"name":2250,"fn":2251,"description":2252,"org":2253,"tags":2254,"stars":2262,"repoUrl":2263,"updatedAt":2264},"mps-aspect-accessories","configure JetBrains MPS module dependencies","Wire MPS module and model dependencies, used languages, used devkits, extended languages, runtime solutions, accessory models, and language\u002Fdependency versions. Use when adding\u002Fremoving module dependencies, importing languages or devkits into a model, declaring runtime solutions, or shipping accessory content visible to consumers without explicit import.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2255,2258,2261],{"name":2256,"slug":2257,"type":15},"Architecture","architecture",{"name":2259,"slug":2260,"type":15},"Configuration","configuration",{"name":17,"slug":18,"type":15},1650,"https:\u002F\u002Fgithub.com\u002FJetBrains\u002FMPS","2026-07-17T06:06:57.311661",{"slug":2266,"name":2266,"fn":2267,"description":2268,"org":2269,"tags":2270,"stars":2262,"repoUrl":2263,"updatedAt":2273},"mps-aspect-actions","define and edit MPS node factories","Use when defining or editing MPS node factories (the \"actions\" aspect) — `NodeFactories` roots, per-concept `NodeFactory` setup functions that initialize a freshly created node and optionally copy data from a replaced `sampleNode`, plus the actions aspect's `CopyPasteHandlers` and `PasteWrappers` roots. Reach for this skill when a substitution, side transform, completion replacement, or `add new initialized(...)` should preserve fields from the node it is replacing, or when defaults set in a constructor are not enough.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2271,2272],{"name":2256,"slug":2257,"type":15},{"name":17,"slug":18,"type":15},"2026-07-17T06:04:48.066901",{"slug":2275,"name":2275,"fn":2276,"description":2277,"org":2278,"tags":2279,"stars":2262,"repoUrl":2263,"updatedAt":2282},"mps-aspect-behavior","define and edit MPS concept behavior","Use when defining or editing MPS `ConceptBehavior` — per-concept methods (non-virtual \u002F virtual \u002F abstract \u002F static \u002F virtual static), constructors, virtual dispatch (MRO), super and interface-default calls (`super\u003CInterface>.method`), overriding methods from `lang.core.behavior` interfaces such as `ScopeProvider.getScope` \u002F `INamedConcept.getName` \u002F `BaseConcept.getPresentation`, calling sibling methods (`LocalBehaviorMethodCall`) and behavior methods from other aspects via `node.method(...)`. Reach for this skill whenever the task involves authoring or modifying `\u003Clang>\u002FlanguageModels\u002Fbehavior.mps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2280,2281],{"name":2256,"slug":2257,"type":15},{"name":17,"slug":18,"type":15},"2026-07-13T06:45:21.757084",{"slug":2284,"name":2284,"fn":2285,"description":2286,"org":2287,"tags":2288,"stars":2262,"repoUrl":2263,"updatedAt":2293},"mps-aspect-constraints","define JetBrains MPS language constraints","Use when defining or editing MPS language constraints — property validators \u002F setters \u002F getters, referent search scopes (imperative or inherited via `ScopeProvider.getScope`), `referentSetHandler` side effects, default-scope blocks, `canBeChild` \u002F `canBeParent` \u002F `canBeAncestor` \u002F `canBeRoot` placement rules, `defaultConcreteConcept` for abstract concepts, `set \u003Cread-only>` and `{name}` aliasing, and scope helpers (`SimpleRoleScope`, `ListScope`, `CompositeScope`, `HidingByNameScope`). Reach for this skill whenever the task involves authoring or modifying `\u003Clang>\u002FlanguageModels\u002Fconstraints.mps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2289,2290],{"name":2256,"slug":2257,"type":15},{"name":2291,"slug":2292,"type":15},"Code Analysis","code-analysis","2026-07-23T05:41:33.639365",{"slug":2295,"name":2295,"fn":2296,"description":2297,"org":2298,"tags":2299,"stars":2262,"repoUrl":2263,"updatedAt":2303},"mps-aspect-dataflow","define and debug MPS dataflow builders","Use when defining or debugging MPS dataflow builders for a concept — control\u002Fdata flow declarations that drive reachability analysis and variable-use checking. Covers DataFlowBuilderDeclaration, BuilderBlock, emit instructions (code for, jump, ifjump, label, read, write, ret, mayBeUnreachable), positions (AfterPosition, BeforePosition, LabelPosition), the jetbrains.mps.lang.dataFlow language, the NodeParameter implicit, BL+smodel usage inside builder bodies, and IBuilderMode for advanced analyses such as nullable\u002Fnon-null tracking.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2300],{"name":2301,"slug":2302,"type":15},"Data Analysis","data-analysis","2026-07-13T06:45:19.114674",{"slug":2305,"name":2305,"fn":2306,"description":2307,"org":2308,"tags":2309,"stars":2262,"repoUrl":2263,"updatedAt":2316},"mps-aspect-editor","define MPS editor layouts","Use when creating or changing MPS editor definitions — the overall workflow from scaffolding a `ConceptEditorDeclaration` through componentizing reusable `EditorComponentDeclaration`s, refining cell models and cell layouts, applying style sheets and indent-layout style items, wiring smart references, leveraging inheritance via super-concepts and interfaces, inspecting (`print_node_json`, `show_node_representation`) and validating (`check_root_node_problems`). Covers `jetbrains.mps.lang.editor` cell models (`CellModel_RefNode`\u002F`CellModel_RefNodeList`\u002F`CellModel_RefCell`\u002F`CellModel_Property`\u002F`CellModel_Constant`), layout choices, and JSON blueprints for common editor shapes. For the non-layout side (action maps, keymaps, transformation\u002Fsubstitute menus) use `mps-aspect-editor-menus-and-keymaps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2310,2313],{"name":2311,"slug":2312,"type":15},"Design","design",{"name":2314,"slug":2315,"type":15},"UI Components","ui-components","2026-07-23T05:41:56.638151",{"slug":2318,"name":2318,"fn":2319,"description":2320,"org":2321,"tags":2322,"stars":2262,"repoUrl":2263,"updatedAt":2325},"mps-aspect-editor-menus-and-keymaps","author MPS editor menus and keymaps","Use when authoring the **non-layout** parts of the MPS editor aspect — what happens when the user types, presses a key, triggers completion, pastes, or invokes a context action. Covers action maps (`CellActionMapDeclaration`), cell keymaps (`CellKeyMapDeclaration`), transformation menus (`TransformationMenu_Default` \u002F `_Named` \u002F `_Contribution`), substitute menus (`SubstituteMenu_Default` \u002F `SubstituteMenu` \u002F contributions), side transforms (LEFT\u002FRIGHT), legacy cell menus, paste wrappers and copy-paste handlers (in the actions language), completion styling, reference presentation, two-step deletion, and the editor selection API. Trigger terms: `actionMap`, `keyMap`, `delete_action_id`, `transformationMenu`, `substituteMenu`, `Ctrl+Space`, `Ctrl+Alt+B`, side transform, paste wrapper, completion styling, `PasteWrappers`, `CopyPasteHandlers`. For the **layout** side (cells, layouts, style sheets) use `mps-aspect-editor` instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2323,2324],{"name":17,"slug":18,"type":15},{"name":2314,"slug":2315,"type":15},"2026-07-23T05:41:49.666535",{"slug":2327,"name":2327,"fn":2328,"description":2329,"org":2330,"tags":2331,"stars":2262,"repoUrl":2263,"updatedAt":2334},"mps-aspect-generation-plan","modify MPS generation plans","Use when defining or modifying an MPS generation plan — explicit ordering of generators, checkpoints for cross-model reference resolution, forks for parallel branches, IncludePlan composition, conditional PlanContribution activation, ParameterEquals\u002FConceptListSelector fork selectors, and InitModelAttributes for targetFacet routing. Apply when working with @genplan models, the jetbrains.mps.lang.generator.plan language, attaching plans via DevKits or the Custom generation facet, or debugging cross-model mapping label resolution.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2332,2333],{"name":2256,"slug":2257,"type":15},{"name":17,"slug":18,"type":15},"2026-07-13T06:44:59.507855",{"slug":2336,"name":2336,"fn":2337,"description":2338,"org":2339,"tags":2340,"stars":2262,"repoUrl":2263,"updatedAt":2344},"mps-aspect-generator","define JetBrains MPS generator rules","Use when defining or modifying MPS generators — author a generator module, add or edit root\u002Freduction\u002Fweaving\u002Fpattern mapping rules, attach template macros ($COPY_SRC, $LOOP, $IF, $PROPERTY, $REF, $SWITCH, $MAP_SRC, $WEAVE, $INSERT, $LABEL, $TRACE, $VAR), wire mapping labels, build template switches, write pre\u002Fpost mapping scripts, navigate `genContext`, or debug \"rule didn't fire\", missing references, empty output, infinite reduction loops, and generated-Java compile failures.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2341,2342,2343],{"name":2256,"slug":2257,"type":15},{"name":2291,"slug":2292,"type":15},{"name":17,"slug":18,"type":15},"2026-07-17T06:06:58.042999",{"slug":2346,"name":2346,"fn":2347,"description":2348,"org":2349,"tags":2350,"stars":2262,"repoUrl":2263,"updatedAt":2353},"mps-aspect-intentions","define and edit MPS intentions","Use when defining or editing MPS intentions (the Alt+Enter context-action aspect) — adding `IntentionDeclaration` roots, parameterized or surround-with variants, description\u002FisApplicable\u002Fexecute blocks, child-filter functions, factory-initialized AST splicing, or debugging why an intention is not offered. Lives in the language's `intentions` model and uses `jetbrains.mps.lang.intentions`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2351,2352],{"name":2256,"slug":2257,"type":15},{"name":17,"slug":18,"type":15},"2026-07-23T05:41:48.692899",{"slug":2355,"name":2355,"fn":2356,"description":2357,"org":2358,"tags":2359,"stars":2262,"repoUrl":2263,"updatedAt":2366},"mps-aspect-migrations","author and debug MPS migration scripts","Use when authoring or debugging MPS migration scripts that upgrade user models after a language definition changes — covers jetbrains.mps.lang.migration (MigrationScript class-based, PureMigrationScript declarative, MoveConcept\u002FMoveContainmentLink\u002FMoveReferenceLink\u002FMoveProperty, ordering via OrderDependency, data exchange via putData\u002FgetData, RefactoringLog, ConceptMigrationReference) and jetbrains.mps.lang.script Enhancement Scripts (MigrationScript with MigrationScriptPart_Instance, ExtractInterfaceMigration, FactoryMigrationScriptPart, CommentMigrationScriptPart) — when a model needs version-gated upgrade, concept rename or removal, link or property rename, instance-level transformation, or composition of migration steps.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2360,2363],{"name":2361,"slug":2362,"type":15},"Debugging","debugging",{"name":2364,"slug":2365,"type":15},"Migration","migration","2026-07-13T06:45:20.372122",{"slug":2368,"name":2368,"fn":2369,"description":2370,"org":2371,"tags":2372,"stars":2262,"repoUrl":2263,"updatedAt":2376},"mps-aspect-structure-concepts","define concepts in MPS structure aspect","Define concepts, interface concepts, enumerations, and constrained data types in an MPS language's `structure` aspect. Covers smart-reference detection, alias rules, cardinality, INamedConcept usage, bulk creation, and the full `mps_mcp_alter_structure` \u002F `mps_mcp_query_structure` reference. Use when authoring or modifying a language's structure model.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2373],{"name":2374,"slug":2375,"type":15},"Data Modeling","data-modeling","2026-07-23T05:41:30.705975",188]