[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E35Y4DZN34EGDHXBBXS9MS":3,"skill-same:01M6E35Y4DZN34EGDHXBBXS9MS":95},{"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":47,"linkOnly":48,"markdownContent":49,"markdownBody":50,"frontMatter":51,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":57,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6E35Y4DZN34EGDHXBBXS9MS","go-127",null,"What changed in Go 1.27 (released August 2026) and how it changes the way Go is written in pi-go. Use this skill when writing or reviewing Go that could use a 1.27 feature, when bumping the `go` directive in go.mod, when a build or test behaves differently after a toolchain upgrade, or when `code-guidelines-go` points here. Covers generic methods, struct-literal field selectors, generalized type inference, the go command and go fix changes, the size-specialized allocator, the `goroutineleak` profile, `encoding\u002Fjson\u002Fv2`, the new `uuid` and `crypto\u002Fmldsa` packages, `strings.CutLast`, `maphash.Hasher`, `synctest.Sleep`, `httptest.NewTestServer`, and every removal that can break a build.","dimetron\u002Fpi-go","dimetron","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F877433?v=4","01M6E34QX9HKYKMWJVZQEPR2Q3","Dmytro Rashko","01M6E34R2A6563XM0PTZE8KPGG",224,"MIT","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fgo-127\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"go","go 127","new","writing","2026","when","generic","break","strings","sleep","toolchain","type","feature","upgrade","crypto","methods","Literal","directive","use","pi","fix","command","specialized","how","code","packages","guidelines","test","2026-11-10 10:12:30",false,"---\nname: go-127\ndescription: >\n  What changed in Go 1.27 (released August 2026) and how it changes the way Go is\n  written in pi-go. Use this skill when writing or reviewing Go that could use a\n  1.27 feature, when bumping the `go` directive in go.mod, when a build or test\n  behaves differently after a toolchain upgrade, or when `code-guidelines-go`\n  points here. Covers generic methods, struct-literal field selectors, generalized\n  type inference, the go command and go fix changes, the size-specialized\n  allocator, the `goroutineleak` profile, `encoding\u002Fjson\u002Fv2`, the new `uuid` and\n  `crypto\u002Fmldsa` packages, `strings.CutLast`, `maphash.Hasher`,\n  `synctest.Sleep`, `httptest.NewTestServer`, and every removal that can break a\n  build.\n---\n\n# Go 1.27 — What Changed and What To Do About It\n\n**Released**: August 2026, six months after Go 1.26. Go 1 compatibility holds; almost\nall programs compile and run unchanged.\n\n**Sources**: [go.dev\u002Fdoc\u002Fgo1.27](https:\u002F\u002Fgo.dev\u002Fdoc\u002Fgo1.27) (authoritative) ·\n[victoriametrics.com\u002Fblog\u002Fgo-1-27](https:\u002F\u002Fvictoriametrics.com\u002Fblog\u002Fgo-1-27\u002F) (worked examples).\nEvery claim below is from one of those two, or from reading\n`$(go env GOROOT)\u002Fsrc` on the installed 1.27.0 toolchain.\n\nCompanion skill: `code-guidelines-go` holds the standing style rules. This skill holds\nonly what 1.27 *changed*.\n\n---\n\n## 0. Read this first — `GOEXPERIMENT=none` is set on this machine\n\n`go env` on this host persists `GOEXPERIMENT=none`, which does **not** mean \"no extra\nexperiments\" — it clears the 1.27 *baseline*, which enables `JSONv2`, `GreenTeaGC`,\n`SizeSpecializedMalloc`, `Dwarf5` and `RandomizedHeapBase64`\n(`src\u002Finternal\u002Fbuildcfg\u002Fexp.go:81`). Verified consequences here:\n\n```\n$ go build .\u002F...                      # importing encoding\u002Fjson\u002Fv2\nimports encoding\u002Fjson\u002Fv2: build constraints exclude all Go files in ...\u002Fencoding\u002Fjson\u002Fv2\n\n$ golangci-lint --version\ngolangci-lint has version 2.13.1 built with go1.27.0-X:nojsonv2,nogreenteagc,\nnorandomizedheapbase64,nosizespecializedmalloc\n```\n\nSo on this machine `encoding\u002Fjson\u002Fv2` will not import, and the 1.27 allocator and GC\nwork are switched off. Before benchmarking anything or trying a v2 snippet:\n\n```bash\ngo env GOEXPERIMENT          # prints \"none\" -> baseline is cleared\ngo env -u GOEXPERIMENT       # restore the default baseline (user decision — ask first)\nGOEXPERIMENT=jsonv2 go build .\u002F...   # or scope it to one command\n```\n\nDo not silently change the user's `go env` config. Flag it, and scope the experiment to\nthe command you are running.\n\n---\n\n## 1. Language changes\n\n### 1.1 Generic methods — methods may declare their own type parameters\n\nThe headline change. Before 1.27 a generic operation on a type had to be a\npackage-level function; now it can live on the type.\n\n```go\n\u002F\u002F ✗ Before 1.27 — generic op stranded at package scope\ntype Box[T any] struct{ v T }\nfunc MapBox[T, U any](b Box[T], f func(T) U) Box[U] { return Box[U]{v: f(b.v)} }\n\n\u002F\u002F ✓ Go 1.27 — the method declares its own type parameter U\ntype Box[T any] struct{ v T }\nfunc (b Box[T]) Map[U any](f func(T) U) Box[U] { return Box[U]{v: f(b.v)} }\n\nb := Box[int]{v: 21}\nlabel := b.Map(func(n int) int { return n * 2 }).\n    Map(func(n int) string { return fmt.Sprintf(\"value=%d\", n) })\n```\n\nTwo hard restrictions, both compiler-enforced:\n\n- **Interfaces may not declare type-parameterized methods.** `Map[U any](...)` inside an\n  `interface` fails with `interface method must have no type parameters`.\n- **A generic method cannot implement an interface method.** So a generic method is\n  never part of a type's interface satisfaction set.\n\n**Prescription for pi-go**: this is the right tool for transforms on a concrete generic\ncontainer (a typed cache, a typed result set). It is the *wrong* tool anywhere the type\nis consumed through an interface — and pi-go's design rule is \"define interfaces at the\nconsumer\" (`code-guidelines-go` §1). If a call site takes an interface, keep the\npackage-level generic function.\n\n### 1.2 Struct literal keys may be any valid field selector\n\nA key in a struct literal is no longer restricted to a top-level field name, so promoted\nfields from an embedded struct can be set directly.\n\n```go\ntype Base struct{ ID int }\ntype User struct {\n    Base\n    Name string\n}\n\nu := User{Base: Base{ID: 7}, Name: \"Mittens\"}  \u002F\u002F ✗ before 1.27, the only way\nu := User{ID: 7, Name: \"Mittens\"}              \u002F\u002F ✓ Go 1.27\n```\n\n`go fix`'s new `embedlit` modernizer rewrites the old form for you (see §2.4).\n\n### 1.3 Function type inference generalized\n\nInference now applies in *every* context where a generic function is assigned to or\nconverted to a matching function type — not just plain assignment. Composite literals\nand conversions now infer too.\n\n```go\nfunc first[T any](s []T) T { return s[0] }\nfunc last[T any](s []T) T  { return s[len(s)-1] }\n\nops := []func([]int) int{first[int], last[int]}  \u002F\u002F ✗ before 1.27: explicit instantiation\nops := []func([]int) int{first, last}            \u002F\u002F ✓ Go 1.27: element type drives T=int\n```\n\nThe old failure was `cannot use generic function without instantiation`\n([VM blog](https:\u002F\u002Fvictoriametrics.com\u002Fblog\u002Fgo-1-27\u002F)). If you see leftover `[int]`\ninstantiations in a slice or map literal of function types, they can now be deleted.\n\n---\n\n## 2. Toolchain, `go` command, modules\n\n### 2.1 `go test` runs `stdversion` by default\n\n`go test` now invokes the `stdversion` vet check, which reports use of stdlib symbols\nnewer than the `go` directive in `go.mod` (adjusted by build tags on the file). This is\nthe guard that catches \"works on my machine\": calling `strings.CutLast` from a module\nstill declaring `go 1.26` is now a **test failure**, not a silent success.\n\n**Prescription**: when you use a 1.27 stdlib symbol, bump `go.mod` in the same change.\nDo not `\u002F\u002Fnolint` around it.\n\n### 2.2 GODEBUG settings that were removed still parse\n\nFrom 1.27 the go command accepts a removed GODEBUG setting in `go.mod` (`godebug`\nlines) and `\u002F\u002Fgo:debug` comments **if it is set to the final default value** established\nbefore removal. Set to an old value, the go command **fails**. So\n`\u002F\u002Fgo:debug asynctimerchan=0` still builds; `asynctimerchan=1` is now a hard error.\n\n### 2.3 `go mod tidy` enforces a two-block `require` layout\n\nFor modules declaring `go 1.27` or later, `go mod tidy` merges duplicate `require`\nblocks into at most two — direct and indirect — preserving attached comment blocks. A\ncomment block spanning a mixed set of directives is merged onto the direct block.\n\n**Expect a large `go.mod` diff** on the first `go mod tidy` after the version bump.\nReview it, do not fight it.\n\n### 2.4 `go fix` modernizers\n\nVerified against `go tool fix help` on 1.27.0:\n\n| Analyzer | Rewrites |\n|---|---|\n| `atomictypes` | basic types in `sync\u002Fatomic` calls → atomic types |\n| `embedlit` | references to embedded fields in composite literals (see §1.2) |\n| `slicesbackward` | backward loops over slices → `slices.Backward` |\n| `unsafefuncs` | unsafe pointer arithmetic → function calls |\n| `waitgroupgo` | `wg.Add(1)`\u002F`go`\u002F`wg.Done()` → `wg.Go` — **renamed** from `waitgroup` |\n\n`fmtappendf` was **removed** (stylistic concerns). If a script or CI job names\n`waitgroup` or `fmtappendf`, it breaks.\n\n### 2.5 `go doc`\n\n- `go doc example.com\u002Fpkg@v1.2.3` — documentation at a specific module version.\n- `go doc -ex \u003Cpkg>` — list a package's runnable examples (verified: `go doc -ex strings`\n  interleaves `func ExampleTrimSpace()` lines under each symbol).\n- `go doc bytes.ExampleBuffer` — prints the example's source with comments.\n\n### 2.6 Other tool changes\n\n- **`bzr` support removed** from the go command; modules on Bazaar servers can no longer\n  be fetched directly.\n- **`go tool trace -http=:6060` now binds localhost only**, matching `go tool pprof`.\n  Pass `-http=0.0.0.0:6060` to listen on all interfaces. Relevant to the `go-pprof`\n  workflow in `AGENTS.md`.\n- **Response files (`@file`)** are accepted by `compile`, `link`, `asm`, `cgo`, `cover`\n  and `pack`, in GCC's format.\n- **Linker**: `-macos` and `-macsdk` set OS\u002FSDK versions in `LC_BUILD_VERSION`.\n  Defaults: macOS 13.0.0, SDK 26.2.0.\n\n---\n\n## 3. Runtime, GC, performance, profiling\n\n### 3.1 Faster small allocations — free, but off on this machine\n\nThe compiler emits calls to size-specialized allocation routines, cutting the cost of\nsome allocations under 80 bytes by **up to 30%**, ~1% overall in allocation-heavy\nprograms, at ~60 KB more binary size (workload-independent). Nothing to change in code.\n\nOpt-out is `GOEXPERIMENT=nosizespecializedmalloc`, **expected to be removed in Go 1.28**.\nPer §0, `GOEXPERIMENT=none` on this host already disables it — so any allocation\nbenchmark run here is measuring the *old* allocator.\n\n### 3.2 `goroutineleak` profile is now GA\n\nThe goroutine leak profile, experimental in 1.26, is generally available. No\n`GOEXPERIMENT` needed; the `goroutineleakprofile` GOEXPERIMENT setting is **deleted**.\n\n```go\n\u002F\u002F scrape in-process\npprof.Lookup(\"goroutineleak\").WriteTo(os.Stdout, 1)\n```\n\nOr the `net\u002Fhttp\u002Fpprof` endpoint `\u002Fdebug\u002Fpprof\u002Fgoroutineleak` — which is what pi-go\nshould use, since it already serves pprof on `:6060` under `pi --pprof true`.\n\nA goroutine counts as leaked when it is blocked on a concurrency primitive (channel,\n`sync.Mutex`, `sync.Cond`, …) that the GC proves unreachable from any runnable goroutine\nor anything those could unblock — so it can never be unblocked. **Known blind spot**:\nleaks where the primitive is reachable through a global, or through the locals of a\nrunnable goroutine, are *not* detected. Long-lived registries in pi-go fall exactly in\nthat gap, so a clean profile is not proof of no leak. Keep `goleak.VerifyTestMain(m)` in\ntests.\n\n### 3.3 Goroutine labels in tracebacks\n\nFor modules with `go 1.27` or later, `runtime\u002Fpprof` goroutine labels appear in the\ntraceback header line — in panics, SIGQUIT dumps and `runtime.Stack` output:\n\n```\ngoroutine 1 [running] {request: 42}:\n```\n\nAnything already wrapped in `pprof.Do(ctx, pprof.Labels(...), ...)` now leaks that\ncontext into crash output. **Check pi-go's labels for anything sensitive** (session ids\nare fine; API keys or prompt text are not) before bumping the `go` directive. Opt-out is\n`GODEBUG=tracebacklabels=0`, added in 1.26 and expected to be kept indefinitely.\n\n### 3.4 Compiler changes with observable effects\n\n- Function literal (closure) names are now **simpler and inlining-independent**, and the\n  compiler may share one compiled body across multiple inlined instances. Tests that\n  assert on symbol names may need updating — better, stop asserting on them.\n- Consequently, **comparing function code pointers for equality is more broken than\n  before**: distinct closures with different captured data can now share a code pointer.\n  Go never defined func comparison beyond `== nil`; 1.27 just exposes it more.\n- Relative filenames in `\u002F\u002Fline` \u002F `\u002F*line*\u002F` directives resolve against the containing\n  file's directory ([#70478](https:\u002F\u002Fgo.dev\u002Fissue\u002F70478)), matching `go\u002Fscanner`.\n\n---\n\n## 4. Standard library\n\n### 4.1 `encoding\u002Fjson\u002Fv2` and `encoding\u002Fjson\u002Fjsontext` (new)\n\n```go\nimport (\n    json \"encoding\u002Fjson\u002Fv2\"\n    \"encoding\u002Fjson\u002Fjsontext\"\n)\n\ndata, err := json.Marshal(Point{X: 1, Y: 2}, opts...)   \u002F\u002F variadic Options\nerr = json.MarshalWrite(w, v, opts...)                   \u002F\u002F to an io.Writer\nerr = json.MarshalEncode(enc, v, opts...)                \u002F\u002F to a *jsontext.Encoder\nerr = json.Unmarshal(data, &v, opts...)\nerr = json.UnmarshalRead(r, &v, opts...)\nerr = json.UnmarshalDecode(dec, &v, opts...)\n```\n\n`jsontext` is the syntactic layer: `Encoder`, `Decoder`, `Token`, `Value`, with a state\nmachine enforcing valid JSON.\n\nv2 chooses stricter defaults than v1: it **rejects invalid UTF-8 in strings** and\n**rejects duplicate object names**. It also **does not sort map keys** (v1 always did) —\npass `json.Deterministic(true)` when you need stable output for golden files.\n\n**`encoding\u002Fjson` (v1) is now backed by v2.** Behavior is preserved; **error message\ntext may differ**. If any pi-go test asserts on a JSON error *string*, that is the thing\nmost likely to break — assert on error identity or a substring you control instead.\nMarshal is at parity; unmarshal is significantly faster. Escape hatch:\n`GOEXPERIMENT=nojsonv2` (expected to be removed in a future release).\n\n**Prescription**: no migration is required and v1 stays supported. Keep pi-go on v1\nunless a call site actually wants v2's strictness or its options; do not do a\nmechanical sweep.\n\n### 4.2 `uuid` (new, top-level stdlib package)\n\nImplements RFC 9562, seeded from a cryptographically secure RNG. `UUID` is `[16]byte`,\nso it is **comparable with `==`** and usable as a map key.\n\n```go\nid := uuid.New()      \u002F\u002F suitable for most purposes; currently == NewV4\nr  := uuid.NewV4()    \u002F\u002F 122 bits of randomness\nk  := uuid.NewV7()    \u002F\u002F 48-bit timestamp prefix — sorts by creation time\nu, err := uuid.Parse(\"f81d4fae-7dec-11d0-a765-00a0c91e6bf6\")\nm := uuid.MustParse(s)          \u002F\u002F panics on bad input\nuuid.Nil(); uuid.Max()          \u002F\u002F functions, not vars\nu.String(); u.Compare(v)        \u002F\u002F Compare is big-endian, RFC 9562 §6.11\n```\n\n`UUID` implements `encoding.TextMarshaler`, `TextAppender` and `TextUnmarshaler`.\n\n**Prescription for pi-go**: drop `github.com\u002Fgoogle\u002Fuuid` for new code. For anything\nwritten to `$HOME\u002F.pi-go\u002Fsessions\u002F` or used as a database\u002Fsession key, prefer `NewV7` —\ntime-ordered ids sort chronologically, which is exactly what the session directory\nlisting wants.\n\n### 4.3 `crypto\u002Fmldsa` (new) — post-quantum signatures\n\nFIPS 204 ML-DSA, in three parameter sets returned by functions: `mldsa.MLDSA44()`,\n`MLDSA65()`, `MLDSA87()`. `Parameters` exposes `PublicKeySize()`, `SignatureSize()`,\n`String()`.\n\n```go\npriv, err := mldsa.GenerateKey(mldsa.MLDSA65())\nsig, err := priv.Sign(rand.Reader, msg, crypto.Hash(0))\nerr = mldsa.Verify(priv.PublicKey(), msg, sig, nil)\n```\n\n`crypto\u002Fx509` handles ML-DSA keys and signatures; `crypto\u002Ftls` gains the `MLDSA44`,\n`MLDSA65`, `MLDSA87` `SignatureScheme` values for TLS 1.3. `crypto.MLDSAMu` is a new\n`Hash` sentinel for external-μ signing (it panics if passed to `RegisterHash`).\n\n### 4.4 `simd` and `simd\u002Farchsimd` (experimental)\n\n`GOEXPERIMENT=simd` at build time. `simd` is portable and vector-size-**agnostic**\n(`Int8s`, `Int32s`, `Float32s`, …; width varies by machine), supporting a scalable\nsubset of `simd\u002Farchsimd`. `archsimd` is architecture-specific and unstable: 128-bit on\nwasm\u002Farm64\u002Famd64, 256-\u002F512-bit on some amd64. **Not for pi-go** — no hot vector loops\nhere, and the API is not stable.\n\n### 4.5 New APIs worth using\n\nSignatures below were read from the 1.27.0 GOROOT, not from the release notes prose.\n\n```go\n\u002F\u002F strings \u002F bytes — replaces the LastIndex dance\nfunc CutLast(s, sep string) (before, after string, found bool)   \u002F\u002F strings\nfunc CutLast(s, sep []byte) (before, after []byte, found bool)   \u002F\u002F bytes\n\nbefore, after, found := strings.CutLast(\"a\u002Fb\u002Fc\", \"\u002F\")  \u002F\u002F \"a\u002Fb\", \"c\", true\nbefore, after, found  = strings.CutLast(\"nosep\", \"\u002F\")  \u002F\u002F \"nosep\", \"\", false\n```\n\n```go\n\u002F\u002F testing\u002Fsynctest — time.Sleep + synctest.Wait in one call\nfunc Sleep(d time.Duration)\n```\n\n```go\n\u002F\u002F net\u002Fhttp\u002Fhttptest — in-memory network, no real port, registers t.Cleanup\nfunc NewTestServer(t testing.TB, handler http.Handler) *Server\n```\n\n```go\n\u002F\u002F hash\u002Fmaphash — the contract for future hash-based containers\ntype Hasher[T any] interface {\n    Hash(*Hash, T)\n    Equal(x, y T) bool\n}\ntype ComparableHasher[T comparable] struct{ \u002F* Equal is == *\u002F }\n```\n\n```go\n\u002F\u002F math\u002Fbig — quotient and remainder with an explicit rounding mode\nfunc (z *Int) Divide(x, y, r *Int, mode RoundingMode) (*Int, *Int)\n\u002F\u002F modes: big.Trunc, big.Floor, big.Round, big.Ceil\n\u002F\u002F 7\u002F2 with Ceil  -> q=4, r=-1\n\u002F\u002F 7\u002F2 with Floor -> q=3, r=1\n```\n\n```go\n\u002F\u002F math\u002Frand\u002Fv2 — the top-level N, now a method (first stdlib generic method)\nfunc (r *Rand) N[Int intType](n Int) Int\n\nr := rand.New(rand.NewPCG(1, 2))\nr.N(100)                  \u002F\u002F int in [0, 100)\nr.N(5 * time.Second)      \u002F\u002F works for any integer-kind type, incl. Duration\n```\n\n```go\n\u002F\u002F net\u002Furl\nfunc (u *URL) Clone() *URL\nfunc (vs Values) Clone() Values\n```\n\nAlso new: `database\u002Fsql.ConvertAssign(scanCtx driver.ScanContext, dest any, src driver.Value) error`;\n`database\u002Fsql\u002Fdriver.RowsColumnScanner`; `go\u002Fconstant.StringLen(x Value) int64`;\n`(*go\u002Fscanner.Scanner).End() token.Pos`; `(*go\u002Ftoken.File).String()`;\n`go\u002Ftypes.Hasher` and `HasherIgnoreTags`.\n\n**Prescriptions**:\n\n- `strings.CutLast` \u002F `bytes.CutLast` replace `LastIndex` + two slice expressions.\n  Grep pi-go for `strings.LastIndex` when touching those call sites.\n- `synctest.Sleep(d)` replaces the `time.Sleep(d); synctest.Wait()` pair that\n  `code-guidelines-go` §6 currently spells out. Prefer it inside a bubble: when the test\n  and the code under test sleep the same duration, plain `time.Sleep` leaves the wake\n  order unpredictable.\n- `httptest.NewTestServer(t, h)` binds no TCP port and self-cleans, so `defer srv.Close()`\n  goes away and round-trips can run in synthetic time under `testing\u002Fsynctest`. Worth\n  trying against the `internal\u002Fcli` sandbox trap in `AGENTS.md`, where\n  `httptest.NewServer` panics in `newLocalListener` — but that has not been demonstrated\n  here, so verify before relying on it.\n- `maphash.Hasher[T]` is a contract for *future* containers; there is no stdlib hash set\n  yet. Use it only if pi-go writes its own hash-based container, and honour the rule that\n  `Equal` values must `Hash` identically.\n\n### 4.6 Behaviour changes that can bite\n\n| Package | Change | What to do |\n|---|---|---|\n| `net\u002Fhttp` | HTTP\u002F1 `Response.Body` **auto-drains** unread content on `Close` (to a conservative limit) so the connection can be reused | Usually a win. If you `Close` early to abort a large download, set `Transport.DisableKeepAlives = true` |\n| `net\u002Fhttp` | HTTP\u002F2 server honours **RFC 9218 client priorities** | `Server.DisableClientPriority = true` restores round-robin |\n| `net\u002Fhttp` | New `Server.MaxHeaderValueCount` caps accepted header values; default `http.DefaultMaxHeaderValueCount` (500) | Set it on pi-go's servers if a client legitimately sends many values |\n| `net\u002Fhttp` | ALPN negotiation now works on a user-supplied `net.Conn` that has `ConnectionState() tls.ConnectionState` | — |\n| `compress\u002Fflate` | Compression speed improved; **exact encoded bytes differ from 1.26** — propagates to `archive\u002Fzip`, `compress\u002Fgzip`, `compress\u002Fzlib`, `image\u002Fpng` | Any golden file holding compressed bytes will fail. Regenerate; do not assert on compressed output |\n| `unicode` | Unicode 15 → **17** | Code points unassigned before (e.g. U+1FADC) now report `IsSymbol`\u002F`IsGraphic` true. Golden files of width-measured or classified text may shift |\n| `net` | `UnixConn` read methods return `io.EOF` directly instead of wrapping in `net.OpError` | Replace `net.OpError` unwrapping with `errors.Is(err, io.EOF)` |\n| `crypto\u002Fx509` | `SystemCertPool` respects `SSL_CERT_FILE`\u002F`SSL_CERT_DIR` on **Windows and Darwin**, switching to the Go verifier | `GODEBUG=x509sslcertoverrideplatform=0` restores platform APIs |\n| `crypto\u002Fx509\u002Fpkix` | `RDNSequence.String` \u002F `Name.String` render string-typed values as strings even for unrecognized OIDs (previously hex DER) — [#33093](https:\u002F\u002Fgo.dev\u002Fissue\u002F33093) | Certificate-subject golden strings may change |\n| `crypto\u002Fecdsa` | `PrivateKey.Sign` validates hash length when `SignerOpts` is non-nil | Passing a mismatched digest now errors |\n| `runtime\u002Fsecret` | Goroutines created in secret mode now run in secret mode | — |\n\n---\n\n## 5. Deprecations and removals\n\n**Removed permanently — these now fail the build or the go command:**\n\n| Removed | Since | Replacement \u002F effect |\n|---|---|---|\n| `asynctimerchan` GODEBUG | 1.23 | `time` channels are **always unbuffered**. `asynctimerchan=1` is now a hard error; `=0` still parses (§2.2) |\n| `gotypesalias` GODEBUG | 1.22 | `go\u002Ftypes` always produces an `Alias` node for alias declarations |\n| `tlsunsafeekm`, `tlsrsakex`, `tls10server` | 1.22 | no escape hatch left |\n| `tls3des`, `x509keypairleaf` | 1.23 | no escape hatch left |\n| `goroutineleakprofile` GOEXPERIMENT | 1.26 | the profile is GA (§3.2) |\n| `bzr` support in the go command | — | vendor the module, or move it |\n| `fmtappendf` go fix analyzer | — | none (dropped on style grounds) |\n\n**Renamed**: go fix `waitgroup` → `waitgroupgo`.\n\n**Newly deprecated**: `crypto\u002Ftls.Config.Rand` — for deterministic testing use\n`testing\u002Fcryptotest.SetGlobalRandom`. Post-quantum hybrid key exchanges can now be\nenabled explicitly via `Config.CurvePreferences` even under `tlsmlkem=0` \u002F\n`tlssecpmlkem=0`; those GODEBUGs were only ever meant to affect the default set used when\n`CurvePreferences` is nil.\n\n**Temporary opt-outs, on a clock** — do not build a workflow on these:\n`GOEXPERIMENT=nosizespecializedmalloc` (expected gone in 1.28) and\n`GOEXPERIMENT=nojsonv2` (expected gone in a future release).\n\n---\n\n## 6. Porting and compatibility checklist\n\nWork through this when bumping the `go` directive to `1.27`:\n\n1. **`go.mod`**: bump the `go` line in the same change as the first 1.27 stdlib symbol —\n   `go test` now runs `stdversion` and will fail otherwise (§2.1).\n2. **`go mod tidy`**: expect the `require` blocks to be consolidated into two (§2.3).\n   Review the diff once, then move on.\n3. **GODEBUG audit**: grep `go.mod` `godebug` lines and `\u002F\u002Fgo:debug` comments for\n   `asynctimerchan`, `gotypesalias`, `tlsunsafeekm`, `tlsrsakex`, `tls3des`,\n   `tls10server`, `x509keypairleaf`. Any of them set to a non-default value now fails.\n4. **Golden files**: regenerate anything holding DEFLATE\u002Fgzip\u002Fzip\u002FPNG bytes, JSON error\n   strings, certificate subject strings, or Unicode-classified text (§4.6).\n5. **pprof labels**: confirm no `pprof.Labels` value carries a secret before tracebacks\n   start printing them (§3.3).\n6. **Symbol-name tests**: closure names changed; func-pointer equality is less reliable\n   (§3.4).\n7. **macOS**: 1.27 requires **macOS 13 Ventura or later** — announced in the 1.26 notes.\n8. **linux\u002Fppc64 (big-endian)**: now targets the **ELFv2** ABI (kernel 3.13+; RHEL7\n   backported to 3.10). cgo, PIE and external linking are supported but need an\n   ELFv2-compatible runtime. Pure-Go builds still default to static internal linking;\n   set `CGO_ENABLED=0` for a static binary from a cgo-optioned program.\n9. **`\u002F\u002Fgo:linkname`**: 1.27 tightens unsanctioned linknames (a `linknamestd` directive\n   restricts some to the stdlib, and `cmd\u002Flink` now checks linkname access to assembly\n   symbols). A dependency reaching into runtime internals is the likely breakage; test\n   the dependency tree early. *(This one is from the VM blog's \"hidden gems\", not the\n   release notes — treat it as a heads-up to verify, not as a documented contract.)*\n10. **Tooling**: `golangci-lint` v2.13.1 parses generic methods and struct-literal field\n    selectors cleanly — verified locally on both constructs, 0 issues, exit 0.\n\n---\n\n## 7. Quick reference\n\n| Concern | Go 1.27 | Was |\n|---|---|---|\n| Generic op on a concrete container | method with own type params | package-level generic func |\n| Setting a promoted field | `User{ID: 7}` | `User{Base: Base{ID: 7}}` |\n| Generic func in a slice literal | `[]func([]int) int{first, last}` | `{first[int], last[int]}` |\n| Split on last separator | `strings.CutLast` \u002F `bytes.CutLast` | `strings.LastIndex` + slicing |\n| Sleep inside a synctest bubble | `synctest.Sleep(d)` | `time.Sleep(d); synctest.Wait()` |\n| HTTP test server | `httptest.NewTestServer(t, h)` | `httptest.NewServer(h)` + `defer Close()` |\n| UUIDs | stdlib `uuid` (`NewV7` for keys) | `github.com\u002Fgoogle\u002Fuuid` |\n| Bounded random from own source | `r.N(100)` | `rand.N(100)` (global) |\n| Rounded integer division | `big.Int.Divide(x, y, r, big.Floor)` | `Quo`\u002F`Mod` + manual adjust |\n| Deep-copy a URL | `u.Clone()` | manual struct copy |\n| Leaked goroutines in prod | `\u002Fdebug\u002Fpprof\u002Fgoroutineleak` | experiment \u002F `goleak` in tests only |\n| Deterministic JSON map order | `json.Deterministic(true)` (v2) | implicit in v1 |\n| `wg.Add`\u002F`Done` modernizer | `go fix -waitgroupgo` | `-waitgroup` |\n","# Go 1.27 — What Changed and What To Do About It\n\n**Released**: August 2026, six months after Go 1.26. Go 1 compatibility holds; almost\nall programs compile and run unchanged.\n\n**Sources**: [go.dev\u002Fdoc\u002Fgo1.27](https:\u002F\u002Fgo.dev\u002Fdoc\u002Fgo1.27) (authoritative) ·\n[victoriametrics.com\u002Fblog\u002Fgo-1-27](https:\u002F\u002Fvictoriametrics.com\u002Fblog\u002Fgo-1-27\u002F) (worked examples).\nEvery claim below is from one of those two, or from reading\n`$(go env GOROOT)\u002Fsrc` on the installed 1.27.0 toolchain.\n\nCompanion skill: `code-guidelines-go` holds the standing style rules. This skill holds\nonly what 1.27 *changed*.\n\n---\n\n## 0. Read this first — `GOEXPERIMENT=none` is set on this machine\n\n`go env` on this host persists `GOEXPERIMENT=none`, which does **not** mean \"no extra\nexperiments\" — it clears the 1.27 *baseline*, which enables `JSONv2`, `GreenTeaGC`,\n`SizeSpecializedMalloc`, `Dwarf5` and `RandomizedHeapBase64`\n(`src\u002Finternal\u002Fbuildcfg\u002Fexp.go:81`). Verified consequences here:\n\n```\n$ go build .\u002F...                      # importing encoding\u002Fjson\u002Fv2\nimports encoding\u002Fjson\u002Fv2: build constraints exclude all Go files in ...\u002Fencoding\u002Fjson\u002Fv2\n\n$ golangci-lint --version\ngolangci-lint has version 2.13.1 built with go1.27.0-X:nojsonv2,nogreenteagc,\nnorandomizedheapbase64,nosizespecializedmalloc\n```\n\nSo on this machine `encoding\u002Fjson\u002Fv2` will not import, and the 1.27 allocator and GC\nwork are switched off. Before benchmarking anything or trying a v2 snippet:\n\n```bash\ngo env GOEXPERIMENT          # prints \"none\" -> baseline is cleared\ngo env -u GOEXPERIMENT       # restore the default baseline (user decision — ask first)\nGOEXPERIMENT=jsonv2 go build .\u002F...   # or scope it to one command\n```\n\nDo not silently change the user's `go env` config. Flag it, and scope the experiment to\nthe command you are running.\n\n---\n\n## 1. Language changes\n\n### 1.1 Generic methods — methods may declare their own type parameters\n\nThe headline change. Before 1.27 a generic operation on a type had to be a\npackage-level function; now it can live on the type.\n\n```go\n\u002F\u002F ✗ Before 1.27 — generic op stranded at package scope\ntype Box[T any] struct{ v T }\nfunc MapBox[T, U any](b Box[T], f func(T) U) Box[U] { return Box[U]{v: f(b.v)} }\n\n\u002F\u002F ✓ Go 1.27 — the method declares its own type parameter U\ntype Box[T any] struct{ v T }\nfunc (b Box[T]) Map[U any](f func(T) U) Box[U] { return Box[U]{v: f(b.v)} }\n\nb := Box[int]{v: 21}\nlabel := b.Map(func(n int) int { return n * 2 }).\n    Map(func(n int) string { return fmt.Sprintf(\"value=%d\", n) })\n```\n\nTwo hard restrictions, both compiler-enforced:\n\n- **Interfaces may not declare type-parameterized methods.** `Map[U any](...)` inside an\n  `interface` fails with `interface method must have no type parameters`.\n- **A generic method cannot implement an interface method.** So a generic method is\n  never part of a type's interface satisfaction set.\n\n**Prescription for pi-go**: this is the right tool for transforms on a concrete generic\ncontainer (a typed cache, a typed result set). It is the *wrong* tool anywhere the type\nis consumed through an interface — and pi-go's design rule is \"define interfaces at the\nconsumer\" (`code-guidelines-go` §1). If a call site takes an interface, keep the\npackage-level generic function.\n\n### 1.2 Struct literal keys may be any valid field selector\n\nA key in a struct literal is no longer restricted to a top-level field name, so promoted\nfields from an embedded struct can be set directly.\n\n```go\ntype Base struct{ ID int }\ntype User struct {\n    Base\n    Name string\n}\n\nu := User{Base: Base{ID: 7}, Name: \"Mittens\"}  \u002F\u002F ✗ before 1.27, the only way\nu := User{ID: 7, Name: \"Mittens\"}              \u002F\u002F ✓ Go 1.27\n```\n\n`go fix`'s new `embedlit` modernizer rewrites the old form for you (see §2.4).\n\n### 1.3 Function type inference generalized\n\nInference now applies in *every* context where a generic function is assigned to or\nconverted to a matching function type — not just plain assignment. Composite literals\nand conversions now infer too.\n\n```go\nfunc first[T any](s []T) T { return s[0] }\nfunc last[T any](s []T) T  { return s[len(s)-1] }\n\nops := []func([]int) int{first[int], last[int]}  \u002F\u002F ✗ before 1.27: explicit instantiation\nops := []func([]int) int{first, last}            \u002F\u002F ✓ Go 1.27: element type drives T=int\n```\n\nThe old failure was `cannot use generic function without instantiation`\n([VM blog](https:\u002F\u002Fvictoriametrics.com\u002Fblog\u002Fgo-1-27\u002F)). If you see leftover `[int]`\ninstantiations in a slice or map literal of function types, they can now be deleted.\n\n---\n\n## 2. Toolchain, `go` command, modules\n\n### 2.1 `go test` runs `stdversion` by default\n\n`go test` now invokes the `stdversion` vet check, which reports use of stdlib symbols\nnewer than the `go` directive in `go.mod` (adjusted by build tags on the file). This is\nthe guard that catches \"works on my machine\": calling `strings.CutLast` from a module\nstill declaring `go 1.26` is now a **test failure**, not a silent success.\n\n**Prescription**: when you use a 1.27 stdlib symbol, bump `go.mod` in the same change.\nDo not `\u002F\u002Fnolint` around it.\n\n### 2.2 GODEBUG settings that were removed still parse\n\nFrom 1.27 the go command accepts a removed GODEBUG setting in `go.mod` (`godebug`\nlines) and `\u002F\u002Fgo:debug` comments **if it is set to the final default value** established\nbefore removal. Set to an old value, the go command **fails**. So\n`\u002F\u002Fgo:debug asynctimerchan=0` still builds; `asynctimerchan=1` is now a hard error.\n\n### 2.3 `go mod tidy` enforces a two-block `require` layout\n\nFor modules declaring `go 1.27` or later, `go mod tidy` merges duplicate `require`\nblocks into at most two — direct and indirect — preserving attached comment blocks. A\ncomment block spanning a mixed set of directives is merged onto the direct block.\n\n**Expect a large `go.mod` diff** on the first `go mod tidy` after the version bump.\nReview it, do not fight it.\n\n### 2.4 `go fix` modernizers\n\nVerified against `go tool fix help` on 1.27.0:\n\n| Analyzer | Rewrites |\n|---|---|\n| `atomictypes` | basic types in `sync\u002Fatomic` calls → atomic types |\n| `embedlit` | references to embedded fields in composite literals (see §1.2) |\n| `slicesbackward` | backward loops over slices → `slices.Backward` |\n| `unsafefuncs` | unsafe pointer arithmetic → function calls |\n| `waitgroupgo` | `wg.Add(1)`\u002F`go`\u002F`wg.Done()` → `wg.Go` — **renamed** from `waitgroup` |\n\n`fmtappendf` was **removed** (stylistic concerns). If a script or CI job names\n`waitgroup` or `fmtappendf`, it breaks.\n\n### 2.5 `go doc`\n\n- `go doc example.com\u002Fpkg@v1.2.3` — documentation at a specific module version.\n- `go doc -ex \u003Cpkg>` — list a package's runnable examples (verified: `go doc -ex strings`\n  interleaves `func ExampleTrimSpace()` lines under each symbol).\n- `go doc bytes.ExampleBuffer` — prints the example's source with comments.\n\n### 2.6 Other tool changes\n\n- **`bzr` support removed** from the go command; modules on Bazaar servers can no longer\n  be fetched directly.\n- **`go tool trace -http=:6060` now binds localhost only**, matching `go tool pprof`.\n  Pass `-http=0.0.0.0:6060` to listen on all interfaces. Relevant to the `go-pprof`\n  workflow in `AGENTS.md`.\n- **Response files (`@file`)** are accepted by `compile`, `link`, `asm`, `cgo`, `cover`\n  and `pack`, in GCC's format.\n- **Linker**: `-macos` and `-macsdk` set OS\u002FSDK versions in `LC_BUILD_VERSION`.\n  Defaults: macOS 13.0.0, SDK 26.2.0.\n\n---\n\n## 3. Runtime, GC, performance, profiling\n\n### 3.1 Faster small allocations — free, but off on this machine\n\nThe compiler emits calls to size-specialized allocation routines, cutting the cost of\nsome allocations under 80 bytes by **up to 30%**, ~1% overall in allocation-heavy\nprograms, at ~60 KB more binary size (workload-independent). Nothing to change in code.\n\nOpt-out is `GOEXPERIMENT=nosizespecializedmalloc`, **expected to be removed in Go 1.28**.\nPer §0, `GOEXPERIMENT=none` on this host already disables it — so any allocation\nbenchmark run here is measuring the *old* allocator.\n\n### 3.2 `goroutineleak` profile is now GA\n\nThe goroutine leak profile, experimental in 1.26, is generally available. No\n`GOEXPERIMENT` needed; the `goroutineleakprofile` GOEXPERIMENT setting is **deleted**.\n\n```go\n\u002F\u002F scrape in-process\npprof.Lookup(\"goroutineleak\").WriteTo(os.Stdout, 1)\n```\n\nOr the `net\u002Fhttp\u002Fpprof` endpoint `\u002Fdebug\u002Fpprof\u002Fgoroutineleak` — which is what pi-go\nshould use, since it already serves pprof on `:6060` under `pi --pprof true`.\n\nA goroutine counts as leaked when it is blocked on a concurrency primitive (channel,\n`sync.Mutex`, `sync.Cond`, …) that the GC proves unreachable from any runnable goroutine\nor anything those could unblock — so it can never be unblocked. **Known blind spot**:\nleaks where the primitive is reachable through a global, or through the locals of a\nrunnable goroutine, are *not* detected. Long-lived registries in pi-go fall exactly in\nthat gap, so a clean profile is not proof of no leak. Keep `goleak.VerifyTestMain(m)` in\ntests.\n\n### 3.3 Goroutine labels in tracebacks\n\nFor modules with `go 1.27` or later, `runtime\u002Fpprof` goroutine labels appear in the\ntraceback header line — in panics, SIGQUIT dumps and `runtime.Stack` output:\n\n```\ngoroutine 1 [running] {request: 42}:\n```\n\nAnything already wrapped in `pprof.Do(ctx, pprof.Labels(...), ...)` now leaks that\ncontext into crash output. **Check pi-go's labels for anything sensitive** (session ids\nare fine; API keys or prompt text are not) before bumping the `go` directive. Opt-out is\n`GODEBUG=tracebacklabels=0`, added in 1.26 and expected to be kept indefinitely.\n\n### 3.4 Compiler changes with observable effects\n\n- Function literal (closure) names are now **simpler and inlining-independent**, and the\n  compiler may share one compiled body across multiple inlined instances. Tests that\n  assert on symbol names may need updating — better, stop asserting on them.\n- Consequently, **comparing function code pointers for equality is more broken than\n  before**: distinct closures with different captured data can now share a code pointer.\n  Go never defined func comparison beyond `== nil`; 1.27 just exposes it more.\n- Relative filenames in `\u002F\u002Fline` \u002F `\u002F*line*\u002F` directives resolve against the containing\n  file's directory ([#70478](https:\u002F\u002Fgo.dev\u002Fissue\u002F70478)), matching `go\u002Fscanner`.\n\n---\n\n## 4. Standard library\n\n### 4.1 `encoding\u002Fjson\u002Fv2` and `encoding\u002Fjson\u002Fjsontext` (new)\n\n```go\nimport (\n    json \"encoding\u002Fjson\u002Fv2\"\n    \"encoding\u002Fjson\u002Fjsontext\"\n)\n\ndata, err := json.Marshal(Point{X: 1, Y: 2}, opts...)   \u002F\u002F variadic Options\nerr = json.MarshalWrite(w, v, opts...)                   \u002F\u002F to an io.Writer\nerr = json.MarshalEncode(enc, v, opts...)                \u002F\u002F to a *jsontext.Encoder\nerr = json.Unmarshal(data, &v, opts...)\nerr = json.UnmarshalRead(r, &v, opts...)\nerr = json.UnmarshalDecode(dec, &v, opts...)\n```\n\n`jsontext` is the syntactic layer: `Encoder`, `Decoder`, `Token`, `Value`, with a state\nmachine enforcing valid JSON.\n\nv2 chooses stricter defaults than v1: it **rejects invalid UTF-8 in strings** and\n**rejects duplicate object names**. It also **does not sort map keys** (v1 always did) —\npass `json.Deterministic(true)` when you need stable output for golden files.\n\n**`encoding\u002Fjson` (v1) is now backed by v2.** Behavior is preserved; **error message\ntext may differ**. If any pi-go test asserts on a JSON error *string*, that is the thing\nmost likely to break — assert on error identity or a substring you control instead.\nMarshal is at parity; unmarshal is significantly faster. Escape hatch:\n`GOEXPERIMENT=nojsonv2` (expected to be removed in a future release).\n\n**Prescription**: no migration is required and v1 stays supported. Keep pi-go on v1\nunless a call site actually wants v2's strictness or its options; do not do a\nmechanical sweep.\n\n### 4.2 `uuid` (new, top-level stdlib package)\n\nImplements RFC 9562, seeded from a cryptographically secure RNG. `UUID` is `[16]byte`,\nso it is **comparable with `==`** and usable as a map key.\n\n```go\nid := uuid.New()      \u002F\u002F suitable for most purposes; currently == NewV4\nr  := uuid.NewV4()    \u002F\u002F 122 bits of randomness\nk  := uuid.NewV7()    \u002F\u002F 48-bit timestamp prefix — sorts by creation time\nu, err := uuid.Parse(\"f81d4fae-7dec-11d0-a765-00a0c91e6bf6\")\nm := uuid.MustParse(s)          \u002F\u002F panics on bad input\nuuid.Nil(); uuid.Max()          \u002F\u002F functions, not vars\nu.String(); u.Compare(v)        \u002F\u002F Compare is big-endian, RFC 9562 §6.11\n```\n\n`UUID` implements `encoding.TextMarshaler`, `TextAppender` and `TextUnmarshaler`.\n\n**Prescription for pi-go**: drop `github.com\u002Fgoogle\u002Fuuid` for new code. For anything\nwritten to `$HOME\u002F.pi-go\u002Fsessions\u002F` or used as a database\u002Fsession key, prefer `NewV7` —\ntime-ordered ids sort chronologically, which is exactly what the session directory\nlisting wants.\n\n### 4.3 `crypto\u002Fmldsa` (new) — post-quantum signatures\n\nFIPS 204 ML-DSA, in three parameter sets returned by functions: `mldsa.MLDSA44()`,\n`MLDSA65()`, `MLDSA87()`. `Parameters` exposes `PublicKeySize()`, `SignatureSize()`,\n`String()`.\n\n```go\npriv, err := mldsa.GenerateKey(mldsa.MLDSA65())\nsig, err := priv.Sign(rand.Reader, msg, crypto.Hash(0))\nerr = mldsa.Verify(priv.PublicKey(), msg, sig, nil)\n```\n\n`crypto\u002Fx509` handles ML-DSA keys and signatures; `crypto\u002Ftls` gains the `MLDSA44`,\n`MLDSA65`, `MLDSA87` `SignatureScheme` values for TLS 1.3. `crypto.MLDSAMu` is a new\n`Hash` sentinel for external-μ signing (it panics if passed to `RegisterHash`).\n\n### 4.4 `simd` and `simd\u002Farchsimd` (experimental)\n\n`GOEXPERIMENT=simd` at build time. `simd` is portable and vector-size-**agnostic**\n(`Int8s`, `Int32s`, `Float32s`, …; width varies by machine), supporting a scalable\nsubset of `simd\u002Farchsimd`. `archsimd` is architecture-specific and unstable: 128-bit on\nwasm\u002Farm64\u002Famd64, 256-\u002F512-bit on some amd64. **Not for pi-go** — no hot vector loops\nhere, and the API is not stable.\n\n### 4.5 New APIs worth using\n\nSignatures below were read from the 1.27.0 GOROOT, not from the release notes prose.\n\n```go\n\u002F\u002F strings \u002F bytes — replaces the LastIndex dance\nfunc CutLast(s, sep string) (before, after string, found bool)   \u002F\u002F strings\nfunc CutLast(s, sep []byte) (before, after []byte, found bool)   \u002F\u002F bytes\n\nbefore, after, found := strings.CutLast(\"a\u002Fb\u002Fc\", \"\u002F\")  \u002F\u002F \"a\u002Fb\", \"c\", true\nbefore, after, found  = strings.CutLast(\"nosep\", \"\u002F\")  \u002F\u002F \"nosep\", \"\", false\n```\n\n```go\n\u002F\u002F testing\u002Fsynctest — time.Sleep + synctest.Wait in one call\nfunc Sleep(d time.Duration)\n```\n\n```go\n\u002F\u002F net\u002Fhttp\u002Fhttptest — in-memory network, no real port, registers t.Cleanup\nfunc NewTestServer(t testing.TB, handler http.Handler) *Server\n```\n\n```go\n\u002F\u002F hash\u002Fmaphash — the contract for future hash-based containers\ntype Hasher[T any] interface {\n    Hash(*Hash, T)\n    Equal(x, y T) bool\n}\ntype ComparableHasher[T comparable] struct{ \u002F* Equal is == *\u002F }\n```\n\n```go\n\u002F\u002F math\u002Fbig — quotient and remainder with an explicit rounding mode\nfunc (z *Int) Divide(x, y, r *Int, mode RoundingMode) (*Int, *Int)\n\u002F\u002F modes: big.Trunc, big.Floor, big.Round, big.Ceil\n\u002F\u002F 7\u002F2 with Ceil  -> q=4, r=-1\n\u002F\u002F 7\u002F2 with Floor -> q=3, r=1\n```\n\n```go\n\u002F\u002F math\u002Frand\u002Fv2 — the top-level N, now a method (first stdlib generic method)\nfunc (r *Rand) N[Int intType](n Int) Int\n\nr := rand.New(rand.NewPCG(1, 2))\nr.N(100)                  \u002F\u002F int in [0, 100)\nr.N(5 * time.Second)      \u002F\u002F works for any integer-kind type, incl. Duration\n```\n\n```go\n\u002F\u002F net\u002Furl\nfunc (u *URL) Clone() *URL\nfunc (vs Values) Clone() Values\n```\n\nAlso new: `database\u002Fsql.ConvertAssign(scanCtx driver.ScanContext, dest any, src driver.Value) error`;\n`database\u002Fsql\u002Fdriver.RowsColumnScanner`; `go\u002Fconstant.StringLen(x Value) int64`;\n`(*go\u002Fscanner.Scanner).End() token.Pos`; `(*go\u002Ftoken.File).String()`;\n`go\u002Ftypes.Hasher` and `HasherIgnoreTags`.\n\n**Prescriptions**:\n\n- `strings.CutLast` \u002F `bytes.CutLast` replace `LastIndex` + two slice expressions.\n  Grep pi-go for `strings.LastIndex` when touching those call sites.\n- `synctest.Sleep(d)` replaces the `time.Sleep(d); synctest.Wait()` pair that\n  `code-guidelines-go` §6 currently spells out. Prefer it inside a bubble: when the test\n  and the code under test sleep the same duration, plain `time.Sleep` leaves the wake\n  order unpredictable.\n- `httptest.NewTestServer(t, h)` binds no TCP port and self-cleans, so `defer srv.Close()`\n  goes away and round-trips can run in synthetic time under `testing\u002Fsynctest`. Worth\n  trying against the `internal\u002Fcli` sandbox trap in `AGENTS.md`, where\n  `httptest.NewServer` panics in `newLocalListener` — but that has not been demonstrated\n  here, so verify before relying on it.\n- `maphash.Hasher[T]` is a contract for *future* containers; there is no stdlib hash set\n  yet. Use it only if pi-go writes its own hash-based container, and honour the rule that\n  `Equal` values must `Hash` identically.\n\n### 4.6 Behaviour changes that can bite\n\n| Package | Change | What to do |\n|---|---|---|\n| `net\u002Fhttp` | HTTP\u002F1 `Response.Body` **auto-drains** unread content on `Close` (to a conservative limit) so the connection can be reused | Usually a win. If you `Close` early to abort a large download, set `Transport.DisableKeepAlives = true` |\n| `net\u002Fhttp` | HTTP\u002F2 server honours **RFC 9218 client priorities** | `Server.DisableClientPriority = true` restores round-robin |\n| `net\u002Fhttp` | New `Server.MaxHeaderValueCount` caps accepted header values; default `http.DefaultMaxHeaderValueCount` (500) | Set it on pi-go's servers if a client legitimately sends many values |\n| `net\u002Fhttp` | ALPN negotiation now works on a user-supplied `net.Conn` that has `ConnectionState() tls.ConnectionState` | — |\n| `compress\u002Fflate` | Compression speed improved; **exact encoded bytes differ from 1.26** — propagates to `archive\u002Fzip`, `compress\u002Fgzip`, `compress\u002Fzlib`, `image\u002Fpng` | Any golden file holding compressed bytes will fail. Regenerate; do not assert on compressed output |\n| `unicode` | Unicode 15 → **17** | Code points unassigned before (e.g. U+1FADC) now report `IsSymbol`\u002F`IsGraphic` true. Golden files of width-measured or classified text may shift |\n| `net` | `UnixConn` read methods return `io.EOF` directly instead of wrapping in `net.OpError` | Replace `net.OpError` unwrapping with `errors.Is(err, io.EOF)` |\n| `crypto\u002Fx509` | `SystemCertPool` respects `SSL_CERT_FILE`\u002F`SSL_CERT_DIR` on **Windows and Darwin**, switching to the Go verifier | `GODEBUG=x509sslcertoverrideplatform=0` restores platform APIs |\n| `crypto\u002Fx509\u002Fpkix` | `RDNSequence.String` \u002F `Name.String` render string-typed values as strings even for unrecognized OIDs (previously hex DER) — [#33093](https:\u002F\u002Fgo.dev\u002Fissue\u002F33093) | Certificate-subject golden strings may change |\n| `crypto\u002Fecdsa` | `PrivateKey.Sign` validates hash length when `SignerOpts` is non-nil | Passing a mismatched digest now errors |\n| `runtime\u002Fsecret` | Goroutines created in secret mode now run in secret mode | — |\n\n---\n\n## 5. Deprecations and removals\n\n**Removed permanently — these now fail the build or the go command:**\n\n| Removed | Since | Replacement \u002F effect |\n|---|---|---|\n| `asynctimerchan` GODEBUG | 1.23 | `time` channels are **always unbuffered**. `asynctimerchan=1` is now a hard error; `=0` still parses (§2.2) |\n| `gotypesalias` GODEBUG | 1.22 | `go\u002Ftypes` always produces an `Alias` node for alias declarations |\n| `tlsunsafeekm`, `tlsrsakex`, `tls10server` | 1.22 | no escape hatch left |\n| `tls3des`, `x509keypairleaf` | 1.23 | no escape hatch left |\n| `goroutineleakprofile` GOEXPERIMENT | 1.26 | the profile is GA (§3.2) |\n| `bzr` support in the go command | — | vendor the module, or move it |\n| `fmtappendf` go fix analyzer | — | none (dropped on style grounds) |\n\n**Renamed**: go fix `waitgroup` → `waitgroupgo`.\n\n**Newly deprecated**: `crypto\u002Ftls.Config.Rand` — for deterministic testing use\n`testing\u002Fcryptotest.SetGlobalRandom`. Post-quantum hybrid key exchanges can now be\nenabled explicitly via `Config.CurvePreferences` even under `tlsmlkem=0` \u002F\n`tlssecpmlkem=0`; those GODEBUGs were only ever meant to affect the default set used when\n`CurvePreferences` is nil.\n\n**Temporary opt-outs, on a clock** — do not build a workflow on these:\n`GOEXPERIMENT=nosizespecializedmalloc` (expected gone in 1.28) and\n`GOEXPERIMENT=nojsonv2` (expected gone in a future release).\n\n---\n\n## 6. Porting and compatibility checklist\n\nWork through this when bumping the `go` directive to `1.27`:\n\n1. **`go.mod`**: bump the `go` line in the same change as the first 1.27 stdlib symbol —\n   `go test` now runs `stdversion` and will fail otherwise (§2.1).\n2. **`go mod tidy`**: expect the `require` blocks to be consolidated into two (§2.3).\n   Review the diff once, then move on.\n3. **GODEBUG audit**: grep `go.mod` `godebug` lines and `\u002F\u002Fgo:debug` comments for\n   `asynctimerchan`, `gotypesalias`, `tlsunsafeekm`, `tlsrsakex`, `tls3des`,\n   `tls10server`, `x509keypairleaf`. Any of them set to a non-default value now fails.\n4. **Golden files**: regenerate anything holding DEFLATE\u002Fgzip\u002Fzip\u002FPNG bytes, JSON error\n   strings, certificate subject strings, or Unicode-classified text (§4.6).\n5. **pprof labels**: confirm no `pprof.Labels` value carries a secret before tracebacks\n   start printing them (§3.3).\n6. **Symbol-name tests**: closure names changed; func-pointer equality is less reliable\n   (§3.4).\n7. **macOS**: 1.27 requires **macOS 13 Ventura or later** — announced in the 1.26 notes.\n8. **linux\u002Fppc64 (big-endian)**: now targets the **ELFv2** ABI (kernel 3.13+; RHEL7\n   backported to 3.10). cgo, PIE and external linking are supported but need an\n   ELFv2-compatible runtime. Pure-Go builds still default to static internal linking;\n   set `CGO_ENABLED=0` for a static binary from a cgo-optioned program.\n9. **`\u002F\u002Fgo:linkname`**: 1.27 tightens unsanctioned linknames (a `linknamestd` directive\n   restricts some to the stdlib, and `cmd\u002Flink` now checks linkname access to assembly\n   symbols). A dependency reaching into runtime internals is the likely breakage; test\n   the dependency tree early. *(This one is from the VM blog's \"hidden gems\", not the\n   release notes — treat it as a heads-up to verify, not as a documented contract.)*\n10. **Tooling**: `golangci-lint` v2.13.1 parses generic methods and struct-literal field\n    selectors cleanly — verified locally on both constructs, 0 issues, exit 0.\n\n---\n\n## 7. Quick reference\n\n| Concern | Go 1.27 | Was |\n|---|---|---|\n| Generic op on a concrete container | method with own type params | package-level generic func |\n| Setting a promoted field | `User{ID: 7}` | `User{Base: Base{ID: 7}}` |\n| Generic func in a slice literal | `[]func([]int) int{first, last}` | `{first[int], last[int]}` |\n| Split on last separator | `strings.CutLast` \u002F `bytes.CutLast` | `strings.LastIndex` + slicing |\n| Sleep inside a synctest bubble | `synctest.Sleep(d)` | `time.Sleep(d); synctest.Wait()` |\n| HTTP test server | `httptest.NewTestServer(t, h)` | `httptest.NewServer(h)` + `defer Close()` |\n| UUIDs | stdlib `uuid` (`NewV7` for keys) | `github.com\u002Fgoogle\u002Fuuid` |\n| Bounded random from own source | `r.N(100)` | `rand.N(100)` (global) |\n| Rounded integer division | `big.Int.Divide(x, y, r, big.Floor)` | `Quo`\u002F`Mod` + manual adjust |\n| Deep-copy a URL | `u.Clone()` | manual struct copy |\n| Leaked goroutines in prod | `\u002Fdebug\u002Fpprof\u002Fgoroutineleak` | experiment \u002F `goleak` in tests only |\n| Deterministic JSON map order | `json.Deterministic(true)` (v2) | implicit in v1 |\n| `wg.Add`\u002F`Done` modernizer | `go fix -waitgroupgo` | `-waitgroup` |\n",{"name":5,"description":7},"main","bcfcd42255878c3d40e545abcdeb2520b6d31a52",".pi-go\u002Fskills\u002Fgo-127",34,"https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go","https:\u002F\u002Fpi-go.sh","https:\u002F\u002Fgithub.com\u002Fdimetron","🎸💻 🚧🦞","2026-11-15 03:48:24",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add dimetron\u002Fpi-go --skill go-127",{"tool":67,"command":68},"bunx","bunx skills add dimetron\u002Fpi-go --skill go-127",{"tool":70,"command":71},"pnpm","pnpm dlx skills add dimetron\u002Fpi-go --skill go-127","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fgo-127\u002FSKILL.md",true,[75,81,87,91],{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"assets\u002Ftemplate.html","ASSET","资产文件",16612,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Frelease-notes-one-pager\u002Fassets\u002Ftemplate.html",{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"example.html","REFERENCE","参考文档",6412,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Frelease-notes-one-pager\u002Fexample.html",{"path":88,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Fchecklist.md",2790,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Frelease-notes-one-pager\u002Freferences\u002Fchecklist.md",{"path":92,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Flayouts.md",12710,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Frelease-notes-one-pager\u002Freferences\u002Flayouts.md",[96,120,143,161,176,196],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":47},"01M70SJ3216A0Y2NXYJJ2MVER0","verify-session-flow","Formally verify the interactive session flow before or after changing it. Use when editing internal\u002Ftui\u002Ftui.go's handleKey, handleInterruptKey, handleInputSubmit, ctrlCCount or quitting, internal\u002Ftui\u002Fagent_loop.go's enqueuePrompt, submit, steerPrompt, cancelAgent or handleAgentDone, or the deferred-init splash — or when a user reports that Ctrl+C quit on the first press, that Esc did not stop a turn or a goal loop, that a queued prompt was lost when they canceled, or that the TUI hung on a spinner nothing could clear.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow\u002FSKILL.md",[],[103,104,105,106,107,108,109,37,110,111,24,112,113,114,115,116,117,19,118,119],"session","verify session flow","verify","flow","submit","editing","init","loop","prompt","interactive","reports","first","goal","CTRL","clear","spinner","tui",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":47},"01M70SJ02CTB40V2VFGAF80SBG","verify-run-pipeline","Formally verify the \u002Frun phase machine before or after changing it. Use when editing internal\u002Ftui\u002Frun.go's phase transitions (handleRunAgentDone, runGates result handling, verifyRunComplete, retryRun, reportGateHang, merge), internal\u002Fsop\u002Fverdict.go's Passed, or the checklist refresh — or when a run merged work it should not have, retried a hung gate, lost a cycle at the retry budget, or merged on a stale PASS.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-run-pipeline\u002FSKILL.md",[],[127,128,105,129,130,131,108,132,133,134,37,24,135,136,137,138,139,140,141,142],"pipeline","verify run pipeline","run","run pipeline","retry","cycle","run phase","machine","phase","refresh","work","verdict","transitions","result","merge","sop",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":47},"01M70SHWJV9N3PQWRAMCQE9C2E","verify-history-rewrite","Formally verify the session-history rewrite path before or after changing it. Use when editing internal\u002Fsession\u002Fautocompact.go, internal\u002Fsession\u002Fcompaction*.go, internal\u002Fsession\u002Fstore.go's Compact\u002FClearEvents\u002FrewriteEvents, internal\u002Fagent\u002Fagent.go's Run\u002FRunStreaming\u002FrunPreTurn, or internal\u002Ftui\u002Fcommands.go's clearConversation\u002FclearSessionContext and the context gauge — or when a turn is canceled mid-flight, a tool call and its result get separated, a session's history disappears while the agent is still working, or the model is sent a tool result whose call was compacted away.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-history-rewrite\u002FSKILL.md",[],[150,151,152,105,153,154,108,103,155,156,37,157,24,158,159,140,129,160,19,119],"history","rewrite","verify history rewrite","get","model","tool","call","compact","store","gauge","commands",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":47},"01M70SHSJ5A2XV5SXBXM96RH7P","verify-goal-loop","Formally verify the \u002Fgoal automatic loop before or after changing it. Use when editing internal\u002Ftui\u002Fgoal.go, internal\u002Ftui\u002Fagent_loop.go's handleAgentDone\u002FcancelAgent\u002FsteerPrompt, or internal\u002Ftools\u002Fgoal.go's GoalController — or when a goal loop will not stop, stops one cycle early, closes a goal that is not met, or restarts a goal you finished.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-goal-loop\u002FSKILL.md",[],[110,168,169,105,115,170,108,132,37,24,171,172,19,119,173,174,175],"verify goal loop","verify goal","goal loop","you","automatic","Tools","it","stop",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":182,"publishedAt":47},"01M70SHPYN1AS6D6RJ8HN270RZ","verify-agent-lifecycle","Formally verify the subagent lifecycle before or after changing it. Use when editing internal\u002Fsubagent\u002Forchestrator.go's Spawn, trackAgent, forwardAgentEvents, terminalStatus, Cancel, ShutdownWithTimeout or evictCompletedAgentsLocked, or internal\u002Fsubagent\u002Fpool.go — or when a canceled agent is reported as failed, an agent vanishes from the list with no verdict, the orchestrator panics on a pool release, or an agent can be canceled twice.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-agent-lifecycle\u002FSKILL.md",[],[183,184,185,105,186,108,37,24,187,188,189,190,138,191,192,193,194,19,174,195],"lifecycle","verify agent lifecycle","agent lifecycle","as","cancel","subagent","can","with","orchestrator","spawn","release","list","pool",{"skillNo":197,"name":198,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":201,"publishedAt":47},"01M6E37WZM8ZF36DRYQGZDGP7M","test-new-skill","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Ftui\u002F.pi-go\u002Fskills\u002Ftest-new-skill\u002FSKILL.md",[],[46,202,203,21],"new skill","test new skill"]