What is new in Go 1.15?
A comprehensive look at the new features, improvements, and changes in Go 1.15 release.
Go 1.15 was released on August 11, 2020, bringing significant improvements to the toolchain, runtime, and standard library.
Toolchain Improvements
Linker Rewrite
The most significant change in Go 1.15 is the complete rewrite of the linker:
- 20% faster linking on average
- 30% less memory usage during linking
- Better foundation for future optimizations
The new linker is written in Go (previously in C) and provides a cleaner architecture.
Smaller Binaries
Go 1.15 produces smaller binaries through improved dead code elimination:
- Typical binaries are 5% smaller
- Better removal of unused code
- More efficient symbol table generation
Runtime Performance
Defer Performance
The defer statement got significant performance improvements:
- Most defers are now nearly zero cost
- Open-coded defers for common cases
- Up to 30% faster in typical usage
// This is now much faster
func processFile(filename string) error {
f, err := os.Open(filename)
if err != nil {
return err
}
defer f.Close() // Nearly zero overhead now
// Process file...
return nil
}
Standard Library Updates
time/tzdata Package
New embedded timezone database package:
import _ "time/tzdata"
- Embeds timezone data into binaries
- Useful for systems without timezone files
- Ensures consistent behavior across platforms
testing Package
New testing.TB.TempDir() method:
func TestSomething(t *testing.T) {
dir := t.TempDir() // Automatically cleaned up
// Use dir for test files
}
Conclusion
Go 1.15 is a solid release focused on performance and tooling improvements. Key takeaways:
- Faster builds with the new linker
- Better performance with defer optimizations
- Smaller binaries through improved optimization
Upgrading to Go 1.15 is recommended for all projects.
Discussion
Comments
Join the conversation through GitHub Discussions. Replies follow your GitHub notification settings.
Comments are powered by GitHub Discussions. Please keep the conversation focused and respectful.