Paul Krill
Editor at Large

Go 1.27 brings support for generic methods

news
Aug 27, 20262 mins

Latest update to Google’s Go programming language introduces three notable enhancements to the language, plus tool and runtime improvements.

shutterstock 40663132 green traffic light on black background
Credit: AlexandreNunes / Shutterstock

Google’s Go programming language has been updated with changes across the language, toolchain, runtime, and standard library.

Released August 19, Go 1.27 brings three notable enhancements to the language specification, the Go team said. First, Go now supports generic methods, in which a method declaration may declare its own type parameters. Second, a key in a struct literal may now be any valid field selector for the struct type, allowing fields in nested or embedded structs to be initialized directly. Third, function type inference now applies in all assignment contexts. This means generic functions now can be used without explicit type arguments in composite literals, type conversions, and channel sends.

Other improvements in Go 1.27 include:

  • go fix includes four new modernizers: atomictypes, embedlit, slicesbackward, and unsafefuncs.
  • go doc now supports package@version queries such as go doc example.com/pkg@v1.2.3.
  • go mod tidy now automatically consolidates multiple require blocks in go.mod into a standard direct and indirect two-block structure.
  • Size-specialized memory allocation reduces small object allocation costs by up to 30%, improving overall performance by ~1% for allocation-heavy programs.
  • The goroutineleak profile in runtime/pprof is now generally available, allowing automatic detection of permanently blocked goroutines.

An August 26 post on the Go blog provides more detail on Go’s new support for generic methods. The Go team said it would cover other Go 1.27 features in additional blog posts in the coming weeks.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author