Go 1.19 improves generics, memory model
Go 1.19, the latest version of Google’s Go (Golang) programming language, has reached production availability. The update improves recently added generics and debuts an enhanced memory model.
With Go 1.19, released August 2, generics development focused on addressing subtle issues and corner cases reported by the community as well as performance improvements (as much as 20% in some generic programs). Long-sought generics capabilities were added to the language with Go 1.18, which was released in March.
Go 1.19 can be downloaded from go.dev for Windows, macOS, and Linux. Other features in Go 1.19:
- A soft memory limit has been added to the garbage collector. The limit can be helpful for optimizing Go programs to run as efficiently as possible in containers with dedicated amounts of memory.
- Performance and implementation improvements include dynamic sizing of coroutine stacks to reduce stack copyrighting, automatic use of additional file descriptors on most Unix systems, jump tables for large switch statements on x86-64 and ARM64, and support for debugger-injected function calls on ARM64.
- A small correction was made to type parameters in method declarations. Existing programs are unaffected.
- Doc comments now support links, lists, and heading syntax, to help users write clearer doc comments, especially in packages with large APIs.
- For security, the os/exec package no longer respects relative paths in PATH lookups.
- A new build constraint,
unix, is satisfied when the targeted OS is any Unilx-like operating system.