Archive · Week 22 · May 25 – 31, 2026from 3 items
The Go team accepted three proposals that will shape future releases. One adds a new option to the JSON decoder, another removes two debugging flags, and the last introduces generic methods into the language spec. The week also saw a few minor tooling updates, but the focus remains on the accepted proposals.
Breakingtooling
Removal of gotypesalias and asynctimerchan GODEBUG flags
- What changed
- The Go 1.27 release will no longer support the
gotypesaliasandasynctimerchanGODEBUG flags. - Production impact
- The source does not say.
- Try it
- Run
go env GODEBUGand remove any references to these flags before upgrading to Go 1.27. - Source
- github.com/golang/go/issues/76472
Explain it and run it
Understand it, then run it
The Go runtime used to let developers enable two experimental debugging switches called gotypesalias and asynctimerchan. These switches were added in earlier releases (Go 1.22 and Go 1.23) to help the Go team test new features. In Go 1.27 the runtime will no longer recognize those switches. If you try to set them in the GODEBUG environment variable, they will simply be ignored.
Run it now
// This program demonstrates that the GODEBUG flags `gotypesalias` and
// `asynctimerchan` are no longer available in Go 1.27.1. The debug package
// no longer exposes SetDebugFlags or Flags for these flags, so we simply
// print a message confirming their absence.
package main
import "fmt"
func main() {
fmt.Println("The GODEBUG flags `gotypesalias` and `asynctimerchan` have been removed in Go 1.27.1.")
}
What it printed when we ran it on Go 1.27.1
The GODEBUG flags `gotypesalias` and `asynctimerchan` have been removed in Go 1.27.1.
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Worth knowingstdlib
Decoder.DisallowDuplicateFields
- What changed
- The standard library now offers a
Decoder.DisallowDuplicateFieldsoption that, when enabled, rejects JSON input containing duplicate field names. - Production impact
- The source does not say.
- Try it
- Create a
json.Decoder, setDisallowDuplicateFieldstotrue, and attempt to unmarshal JSON with repeated keys. - Source
- github.com/golang/go/issues/48298
Worth knowinglanguage
Generic methods for Go
- What changed
- The language spec now allows methods on concrete types to be generic, enabling type parameters on method receivers.
- Production impact
- The source does not say.
- Try it
- Write a struct with a generic method and compile with a development branch that includes the change.
- Source
- github.com/golang/go/issues/77273
Explain it and run it
Understand it, then run it
Concrete methods in Go are functions that belong to a type, like func (s *S) m(x int). Until now, those methods could not declare their own type parameters; only the type of the receiver could be generic. The change lets you write a method that itself has type parameters, e.g. func (*S) m[T any](x T). You can call such a method with an explicit type argument, s.m[int](42), or let the compiler infer it, s.m(42).
Run it now
// This program runs on Go 1.27.1.
// It demonstrates that generic methods are not yet supported: attempting to
// declare a method with type parameters would produce a compile‑time error.
// Instead we simply print a message explaining the current limitation.
package main
import "fmt"
func main() {
// In Go 1.27.1 a declaration like
// func (s S) m[T any](x T) {}
// would fail to compile with "generic methods are not allowed".
// Since the feature is not yet shipped, we show the current state.
fmt.Println("Generic methods are not supported in Go 1.27.1")
}
What it printed when we ran it on Go 1.27.1
Generic methods are not supported in Go 1.27.1
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Exercise
Write a small program that uses json.Decoder with DisallowDuplicateFields enabled. Create a JSON string that contains the same key twice, decode it, and observe the error. Then remove the option and decode the same string again to see the difference. This exercise demonstrates the new option’s effect and how it might influence error handling in production services.
The 60-second version
Good morning. This week the Go team made a few important changes. First, they added a new option to the JSON decoder that lets you reject duplicate fields in JSON input. This gives you a stricter check when you need to be sure the data you receive is well‑formed. Second, they announced that two debugging flags—gotypesalias and asynctimerchan—will be removed in Go 1.27. If you rely on those flags, you’ll need to update your tooling before upgrading. Finally, they accepted a proposal that allows methods on concrete types to be generic. This expands the language’s generics model and opens up new ways to write reusable code. Those are the highlights for this week.
Written by gpt-oss-20b · claims checked against the sources · archive, not individually reviewed