Hop over the menu
The Red Pantry

A programming site about language and runtime versions

2 Go opt-out settings planned for removal in 1.27 and 1.28

Planning an upgrade

Editorial standards for these guides, including how The Red Pantry uses AI

Neat takeaways

  • The two opt-outs in the title are build-time GOEXPERIMENT switches, not run-time GODEBUG settings, so you set them in a build command or CI variable rather than in go.mod.
  • The Green Tea opt-out, GOEXPERIMENT=nogreenteagc, was expected to be removed in Go 1.27, and the Go 1.27 release notes do not name it, so test it on the toolchain you plan to use.
  • The size-specialized allocation opt-out, GOEXPERIMENT=nosizespecializedmalloc, is expected to be removed in Go 1.28.
  • Go's compatibility promise is about source code, and binary compatibility for compiled packages is not guaranteed between releases, so rebuild with each new toolchain.
  • For a move to Go 1.28, the removed GODEBUG settings are a second risk, because the go command fails when a removed setting carries an old value.
  • Public write-ups describe the Green Tea gain as a cut in garbage-collector time, not a cut in program runtime.

The two settings and what "opt-out" means

An opt-out setting is a switch that turns a newer Go behavior off so an existing build keeps the older behavior until the switch itself is removed. The Go 1.26 release notes describe the Green Tea collector's opt-out, GOEXPERIMENT=nogreenteagc, as a build-time setting ( Go 1.26 release notes ).

Both settings in the title are GOEXPERIMENT switches. Go's GODEBUG settings are a separate family: a GODEBUG setting that is not named in the environment takes its value from the Go toolchain defaults, adjusted to the go line in go.mod, and explicit //go:debug lines can override it ( GODEBUG documentation ). That split matters because editing go.mod changes GODEBUG defaults but does not change either opt-out. The Go 1.27 release notes also record GODEBUG removals, such as the asynctimerchan setting, which "has been removed permanently" ( Go 1.27 release notes ). So a planning list for 1.27 and 1.28 has two halves: the two build switches covered here, and the GODEBUG removals covered in the compatibility section.

This is who this post is for

This article is for Go developers who keep older builds running while they choose between a move to Go 1.27 and a move to Go 1.28, and whose build scripts, Makefiles or CI jobs already set a GOEXPERIMENT variable. If your builds set neither opt-out nor any GODEBUG value, the two switches do not change your build.

Red flags: your CI sets GOEXPERIMENT for a Go 1.26 build and nobody has built with Go 1.27 since; your go.mod or a //go:debug line carries an old value for a setting that has since been removed.

Release dates and support windows

The release dates set the clock for both opt-outs. Go 1.27 release date: Aug 2026 according to endoflife.date , and Go 1.26 arrived 10 Feb 2026 according to endoflife.date . The release dates table sets out those two versions beside their latest listed patch releases and the support status the same listing shows.

Release Released Latest patch listed Support status listed
Go 1.26 10 Feb 2026 Latest 1.26 patch (10 Nov 2026) Yes
Go 1.27 Aug 2026 1.27.4 (10 Nov 2026) Yes
Go 1.28 No date listed No patch listed Not listed

Under the Go project's support rule, a major release is supported until two newer major releases exist ( Go release history ). Applied to the table, Go 1.26 keeps receiving critical fixes until two newer major releases exist, which means until Go 1.28 ships. The Go 1.26 release notes also say "We expect that Go 1.28 will require a minor release of Go 1.26 or later for bootstrap" ( Go 1.26 release notes ), which matters only to teams that build the Go toolchain itself from source, and any release from Go 1.26 on, Go 1.27 included, meets it.

Option one: the Green Tea opt-out, GOEXPERIMENT=nogreenteagc

The Green Tea garbage collector was an experiment in Go 1.25 and became the default in Go 1.26. The Go 1.26 release notes add that the collector is "enabled by default after incorporating feedback," and that the opt-out is expected to be removed in the following release ( Go 1.26 release notes ). That deadline is the first figure a team on Go 1.26 needs.

The gain is the figure most readers look for. Green Tea GC overhead cut: 10-40% according to dev.to , which describes it as a reduction in time spent by the garbage collector.

Teams whose garbage-collection-heavy services slowed after the Go 1.26 default change are the ones this switch fits, because it lets them keep the pre-default collector while they investigate. Teams on a Go 1.26 build that shows no change have no reason to set it. The limits are concrete. The switch works only at build time, the Go 1.26 notes expect its removal in Go 1.27, and the Go 1.27 release notes do not name it at all. Those notes do not tell you whether the opt-out builds on your installed toolchain, so run a test build before you rely on it.

Applying the switch takes one environment variable for one build, as in GOEXPERIMENT=nogreenteagc go build ./... . Because the switch is read at build time, each build command needs its own setting, and a CI job that builds several packages must set it for every one of them.

Option two: the size-specialized allocation opt-out, GOEXPERIMENT=nosizespecializedmalloc

The Go 1.27 release notes describe a compiler change that calls size-specialized memory allocation routines for small allocations. Small object allocation cost cut: up to 30% , according to glonce.com , which reports the gain for size-specialized allocation. The gain is concentrated in small allocations, and the overall effect depends on how allocation-heavy the program is.

The cost is binary size. The release notes say the change "causes the binary size to increase by about 60 KB (independent of the workload)" according to Go 1.27 release notes . The opt-out therefore trades that size and the allocation gain for the older routines. The same notes add "Please file an issue if you notice any regressions," which is the channel to use if an allocation-heavy service slows down ( Go 1.27 release notes ).

Teams running allocation-heavy services on Go 1.27 that regress on the new routines are the ones this switch fits, because it lets them keep the older routines until Go 1.28. The limits are that the switch works only at build time, and the release notes expect this opt-out setting to be removed in the following release ( Go 1.27 release notes ). A Go 1.28 build may therefore have no allocation switch at all. To disable the routines, set GOEXPERIMENT=nosizespecializedmalloc at build time ( Go 1.27 release notes ).

Head to head: the two opt-outs

The head-to-head table lines up the two switches on the details that decide a choice between them.

Switch Feature it turns off Removal expected Figure the sources give
GOEXPERIMENT=nogreenteagc Green Tea garbage collector Go 1.27 GC overhead cut 10-40%
GOEXPERIMENT=nosizespecializedmalloc Size-specialized small allocations Go 1.28 Small allocation cost cut up to 30%; binary about 60 KB larger

Read across the rows. The Green Tea switch has the earlier removal, and its benefit is measured in garbage-collector time. The allocation switch stays longer, and its trade is binary size against small-allocation cost. A team choosing between them is usually choosing which symptom to isolate first, not which feature to keep. The table of figures by source shows where each range comes from, and the dev.to piece describes the Green Tea range as garbage-collector time, not a cut in program runtime.

Source Published Figure What it measures
dev.to Not shown 10-40% Time the collector spends, not program runtime
glonce.com Not shown up to 30% Small object allocation cost

The compatibility rule until removal

The compatibility rule starts with Go's promise that programs written to the Go 1 specification should keep compiling and running unchanged ( Go compatibility guarantee ). The Go 1.27 release notes apply the same expectation to that release: "We expect almost all Go programs to continue to compile and run as before" ( Go 1.27 release notes ).

The promise is about source code, not compiled files. The compatibility guarantee says compatibility is at the source level, and binary compatibility for compiled packages is not guaranteed between releases ( Go compatibility guarantee ).

The build-time rule covers the two opt-outs. Each build picks its switch, and the switch lasts until the release named for its removal. Because go.mod does not set GOEXPERIMENT, a go.mod edit cannot turn either opt-out on or off for every build at once. The GODEBUG rule is different and sets the default for run-time settings: a module's go line decides them, unless a //go:debug line overrides them ( GODEBUG documentation ).

The GODEBUG removal rule is the one that breaks old builds. The Go 1.27 release notes say that, starting with Go 1.27, the go command recognizes a GODEBUG setting whose support was removed when it appears in go.mod godebug entries or //go:debug comments. The go command "accepts these settings if they are set to the final default value established before the setting was removed." But "If they are set to an old value, the go command will fail" ( Go 1.27 release notes ). The release notes frame this as keeping supported settings working: it "allows existing programs that set supported GODEBUG settings to continue to build and run without changes even when the respective setting support has been removed" ( Go 1.27 release notes ).

The rules table sets the two setting families side by side.

Setting family Where it is set When it changes Removal rule
GOEXPERIMENT opt-outs (nogreenteagc, nosizespecializedmalloc) Build command or environment at build time Each build that sets it Removal version named in the release notes
GODEBUG settings Environment, go.mod godebug entries, //go:debug comments Follows the go line in go.mod unless overridden Removed settings accepted only at their final default from Go 1.27

Worked example: a Go 1.26 service moving to Go 1.28

Take a service built with Go 1.26 whose build script sets GOEXPERIMENT=nogreenteagc, and suppose it moves to Go 1.28 in one step. The Go 1.27 release has already shipped ( Go release history ), so the Green Tea switch was expected to be gone before this move, and the build has to be checked against the toolchain that will run. The service therefore has two checks before the 1.28 move: a test build on the target toolchain with the GOEXPERIMENT line removed, and a search of go.mod and every //go:debug line for old values on removed GODEBUG settings, because from Go 1.27 the go command fails on them.

Glossary

  • GOEXPERIMENT : a build-time environment variable that turns experimental Go features on or off, as in GOEXPERIMENT=nogreenteagc.
  • GODEBUG : run-time settings that keep older behavior available, with defaults that follow the go line in go.mod.
  • go line : the go directive in go.mod that sets the default GODEBUG values for a module.
  • Opt-out : a switch that turns a newer behavior off until the release that removes the switch.
  • Green Tea garbage collector : the collector that became the default in Go 1.26.
  • Size-specialized allocation : the compiler change that calls specialized routines for small memory allocations in Go 1.27.
  • Bootstrap : building a newer Go toolchain with an earlier one.
  • Binary compatibility : whether a compiled package built by one release works with another; Go does not guarantee it between releases.

Common mistakes

  • Putting GOEXPERIMENT in go.mod. It is a build-time setting, while the go line in go.mod sets the defaults for GODEBUG settings ( GODEBUG documentation ).
  • Reading the Green Tea range as a speed-up for the whole program. The range is a reduction in time spent by the garbage collector, not in program runtime.
  • Assuming Go 1.27 removed the Green Tea switch because the Go 1.26 notes expected it. The Go 1.27 release notes do not mention it, so test it.
  • Leaving an old value for a removed GODEBUG setting in go.mod. From Go 1.27, the go command fails on an old value ( Go 1.27 release notes ).
  • Mixing up the two dates. The Green Tea switch was expected to go in Go 1.27, and the allocation switch in Go 1.28 ( Go 1.27 release notes ).

Steps before a Go 1.28 move

  1. List every GOEXPERIMENT variable in your build scripts, Makefiles and CI configuration, so you know which builds depend on an opt-out.
  2. Check on your target toolchain whether the Green Tea switch is still accepted, then build again without it. The release notes do not settle the first question for you.
  3. Search go.mod and every //go:debug line for GODEBUG values, and replace any old value on a removed setting with its final default value, since the go command fails on old values ( Go 1.27 release notes ).
  4. Rebuild your packages with the new toolchain rather than reusing compiled packages from an older one, because binary compatibility for compiled packages is not guaranteed between releases ( Go compatibility guarantee ).
  5. Plan for the allocation switch to be gone in Go 1.28, since the release notes expect its removal in that release ( Go 1.27 release notes ).

Which opt-out should you pick?

  • If you see a slowdown in a garbage-collection-heavy service after the Go 1.26 default change, pick GOEXPERIMENT=nogreenteagc because the Go 1.26 notes give it as the build-time switch for that collector.
  • If you see an allocation-heavy service regress on Go 1.27, pick GOEXPERIMENT=nosizespecializedmalloc because the Go 1.27 release notes give it as the build-time switch that disables the new allocation routines.
  • If you keep an old value on a removed GODEBUG setting in go.mod, pick that setting's final default value because the Go 1.27 release notes accept only that value.

FAQs

Are the two settings in the title GODEBUG settings?

No, both are build-time GOEXPERIMENT switches, and the Go 1.26 and Go 1.27 release notes both describe them as values set at build time ( Go 1.26 release notes , Go 1.27 release notes ).

Did Go 1.27 remove the Green Tea opt-out?

The Go 1.27 release notes do not name the Green Tea opt-out, so the sources here do not confirm a removal. Run a test build on your own toolchain before you depend on the switch.

Does the size-specialized allocation opt-out still work on Go 1.27?

The Go 1.27 release notes document it as a build-time switch ( Go 1.27 release notes ). Its removal is expected in Go 1.28, so it is the switch that carries into the next release.

Does a go.mod edit control either opt-out?

No, a go.mod edit does not control either opt-out, because both are build-time GOEXPERIMENT switches. The go line in go.mod sets the defaults for GODEBUG settings instead ( GODEBUG documentation ).

Does the Green Tea range mean my program runs faster?

No, the range describes garbage collection overhead, not program runtime. The common mistakes section covers the quoted sentence that makes this distinction.

When does Go 1.26 stop receiving fixes?

Under the Go project's policy, Go 1.26 is supported until two newer major releases exist, so it lapses when the second of those newer releases ships ( Go release history ).

Does building Go 1.28 need Go 1.26 installed?

Only if you build the Go toolchain from source. The notes ask for a minor release of Go 1.26 or later, so a Go 1.27 install also qualifies ( Go 1.26 release notes ).

Read next

General information about language versions, not legal or contract advice.

Browse more guides