# Go 1 26

> Apply Go 1.26 language features, tooling, standard-library APIs, migrations, and behaviour changes. Load for Go work targeting 1.26 or later when the model's knowledge may predate the 2026-02-10 release.

- Skill: `cedws/go-1-26` (Agent Skill)
- Install (CLI): `npx skillmds@latest add cedws/go-1-26`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cedws/go-1-26/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: cedws (https://skillmd.com/u/cedws)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cedws/go-1-26

---


# Go 1.26

This overview applies when the project's target Go version is at least 1.26.

## Language

- `new(expression)` is available when an API needs a pointer to an initial value, especially for optional serialization fields. Prefer it to a temporary variable whose only purpose is taking an address.
- **Available capability:** self-referential generic constraints when an operation must accept and return the concrete implementing type.

```go
type Adder[A Adder[A]] interface {
	Add(A) A
}
```

## Tools and modules

- `go fix` can apply behaviour-preserving modernisers for current language and standard-library idioms. Use `//go:fix inline` directives when maintaining an API whose callers need a source-level migration.
- After `go mod init`, set the intended compatibility explicitly when it differs from the generated default. A Go 1.26 toolchain initially writes `go 1.25.0`.
- **Replacement:** `go tool doc` with `go doc`; the former has been removed.
- `pprof -http` opens in flame-graph view; the graph view remains selectable explicitly.

## Runtime and diagnostics

- **Available capability:** the Green Tea garbage collector as the default. Enable `GOEXPERIMENT=nogreenteagc` only as a temporary diagnostic opt-out and report behaviour or performance regressions.
- `GOEXPERIMENT=goroutineleakprofile` enables investigate unreachable, permanently blocked goroutines. Inspect the `goroutineleak` profile through `runtime/pprof` or `/debug/pprof/goroutineleak`, and account for its reachability-based detection limits.
- 64-bit heap base randomisation is enabled. `GOEXPERIMENT=norandomizedheapbase64` provides a diagnostic opt-out.

## Standard library

- `crypto/hpke` supports RFC 9180 Hybrid Public Key Encryption, including supported post-quantum hybrid KEMs.
- `errors.AsType[T]` is the modern alternative to `errors.As` in most typed error extraction because it is type-safe and avoids an output pointer.
- `bytes.Buffer.Peek` can inspect buffered bytes without advancing the buffer.
- `log/slog.NewMultiHandler` is available when one record must be dispatched to several handlers while preserving each handler's `Enabled` decision.
- **Available capability:** the context-aware `net.Dialer.DialIP`, `DialTCP`, `DialUDP`, and `DialUnix` methods when a concrete network type is required.
- **Established API:** `http.Transport.RoundTrip` for managed connection pooling. Use `Transport.NewClientConn` only when implementing custom connection management.
- **Replacement:** `httputil.ReverseProxy.Director` with `ReverseProxy.Rewrite`; `Director` is deprecated because clients can remove headers it adds through hop-by-hop header declarations.
- **Available capability:** the new `reflect` field, method, input, and output iterators instead of index loops when iterating reflection metadata or values.

## Cryptography

- **Unsupported or discouraged:** inject randomness through the reader parameters of affected `crypto/dsa`, `crypto/ecdh`, `crypto/ecdsa`, `crypto/rand`, or `crypto/rsa` operations; Go 1.26 ignores them and uses a secure global source.
- `testing/cryptotest.SetGlobalRandom` supports deterministic cryptographic tests. Treat `GODEBUG=cryptocustomrand=1` as temporary migration support.
- **Migration note:** away from the deprecated `big.Int` fields of ECDSA keys and from deprecated RSA PKCS #1 v1.5 encryption. Prefer modern key APIs and OAEP-based encryption.
- The hybrid `SecP256r1MLKEM768` and `SecP384r1MLKEM1024` TLS key exchanges are enabled by default. `Config.CurvePreferences` expresses an explicit protocol policy.

## Testing

- **Test artefact support:** persistent test output through `T.ArtifactDir`, `B.ArtifactDir`, or `F.ArtifactDir`, and run `go test -artifacts` when the artefacts must survive the test process.
- `for b.Loop() { ... }` is the modern alternative to `for i := 0; i < b.N; i++ { ... }`; Go 1.26 permits inlining in the loop body while retaining benchmark work against elimination.

## Experimental features

- **Experimental or compatibility option:** `GOEXPERIMENT=simd` only for architecture-specific amd64 SIMD evaluation. Treat `simd/archsimd` as unstable and non-portable.
- **Experimental or compatibility option:** `GOEXPERIMENT=runtimesecret` only on Linux amd64 or arm64 when evaluating secure erasure of cryptographic temporaries. Treat the API as unstable.

## Compatibility

- **Unsupported or discouraged:** compare JPEG encoder output bit-for-bit across the upgrade; the encoder and decoder implementations changed.
- `ServeMux` trailing-slash redirects now use status 307, and that `net/url.Parse` rejects malformed host colons. Use `GODEBUG=urlstrictcolons=0` only while migrating malformed inputs.
- **Compatibility outlook:** for Go 1.27 to remove compatibility switches for older TLS defaults, `go/types` alias representation, and asynchronous timer channels.
- **Platform requirement:** macOS 12 or later, plan to require macOS 13 with Go 1.27, and remove any `windows/arm` build target.

