Go 1 21
Apply Go 1.21 language features, tooling, standard-library APIs, migrations, and behaviour changes. Load for Go work targeting 1.21 or later when the model's knowledge may predate the 2023-08-08 release.From its SKILL.md
npx -y skills add cedws/skills --skill go-1-21Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 25 days oldThe repository was created 25 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.5 KB, 724 tokens by cl100k_base, as published. Nobody here has run it
Go 1.21
This overview applies when the project's target Go version is at least 1.21.
Language
- The built-in
minandmaxfunctions select an extremum from a fixed set of ordered values without hand-written comparisons. clearcan empty a map or zero every element of a slice without deletion or zeroing loops.- Type inference covers more generic function arguments, generic function assignments, and interface method matching, reducing the need for explicit type arguments.
panic(nil)now produces*runtime.PanicNilError, ensuring that a directly deferredrecoverreturns a non-nil value.GODEBUG=panicnil=1provides temporary compatibility with the older behaviour.
Toolchains and builds
- The
godirective ingo.modorgo.workis a strict minimum version, while thetoolchaindirective can suggest a newer toolchain without raising the language and module-semantics minimum. - Automatic toolchain selection can find or download a newer Go release when a module requires it.
- Version-sensitive
GODEBUGdefaults follow thegodirective, allowing a newer toolchain to preserve older language-version behaviour. - A representative production CPU profile named
default.pgoin a main package enables profile-guided optimisation automatically;-pgocontrols an explicit profile location or opt-out. go test -fullpathemits unambiguous source paths, and a directory argument togo test -osupports several test binaries.
Generic collection and logging APIs
- The generic
slicesandmapspackages provide common collection operations that previously required local implementations. cmp.Compare,cmp.Less, andcmp.Orderedsupport ordered generic algorithms and comparators forsliceshelpers.log/slogprovides structured, levelled logging with keys and values orslog.Attrvalues.testing/slogtestvalidates customslog.Handlerimplementations.
Standard library
context.WithoutCancelallows work to outlive parent cancellation while retaining values.WithDeadlineCause,WithTimeoutCause, andCausepreserve deadline reasons, whileAfterFuncregisters cancellation-triggered work.errors.ErrUnsupportedgives unsupported operations a portable identity througherrors.Is.sync.OnceFunc,sync.OnceValue, andsync.OnceValuescover common function and result-caching forms ofsync.Once.reflect.SliceHeaderandreflect.StringHeaderare deprecated;unsafe.Slice,unsafe.SliceData,unsafe.String, andunsafe.StringDataare their safer replacements.- Low-level
crypto/ellipticcurve operations are deprecated.crypto/ecdhcovers ECDH, while lower-level curve arithmetic requires a maintained implementation. runtime.Pinnerallows non-Go code to retain references to explicitly pinned Go memory until it is unpinned.testing.Testingreports whether the running program is ago testbinary.
Experimental and compatibility features
- The per-iteration loop-variable behaviour is a preview in Go 1.21; the language still uses one variable per loop by default.
GOEXPERIMENT=cgocheck2provides the thorough cgo pointer checker, replacing the removed runtime settingGODEBUG=cgocheck=2.- Supported systems start at macOS 10.15, Windows 10, and Windows Server 2016.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.