Go Time podcast discusses what's new in Go 1.21, including the addition of generics, tool improvements, and new built-ins. They explore the benefits of Go's access to Web Assembly for plugin systems and compare XML and YAML as configuration formats. The hosts also discuss minor changes in Go, opportunities for contributing to the Go project, and future plans for Go 1.22.
Go 1.21 introduces Profile Guided Optimization (PGO) to improve performance based on real-world data.
XML remains relevant in web development, as demonstrated by the popularity of JSX.
Go 1.21 enhances the compatibility and management of dependencies through improved go.mod file support.
Deep dives
XML is better than YAML
XML is a more appropriate choice for situations that require extensible markup language and structured documents. It is suitable for annotating verses in a book, adding subtitles, and configuring complex systems. YAML, on the other hand, often leads to issues and can be error-prone, as demonstrated in cases like misinterpreting version numbers. Alternative formats like TOML or custom languages, with JSON as an underlying canonical format, should be considered for better readability and maintainability.
React's JSX demonstrates XML's usefulness
The popularity of React's JSX, which is essentially inline XML, highlights the practicality and relevance of XML in certain contexts. JSX's success indicates that XML can be a suitable choice for representing structured components and markup in web development.
YAML has inherent limitations
YAML is not recommended as an appropriate choice due to its potential drawbacks and limitations. Issues with interpreting version numbers, requiring proper quotation and indentation, and the absence of better alternatives like TOML or language-specific configurations make YAML less preferable.
Profile Guided Optimization (PGO) in Go 1.21
Profile Guided Optimization (PGO) is a new feature in Go 1.21 that aims to improve performance by optimizing the binary based on real-world data gathered during production. When the binary is run in production, it collects information about hot paths and optimization opportunities. This data is then used during a second compilation step to generate a better optimized binary. Initial results have shown around a 10% improvement in performance. PGO offers a passive approach to identifying and optimizing hot paths without the need for manual profiling and refactoring.
Improved Go Toolchain Compatibility
Go 1.21 introduces improved forward and backward compatibility in the go.mod file. By specifying the go version in the go.mod file, developers can better manage dependencies and ensure compatibility with different versions of the Go toolchain. This feature helps avoid potential issues when working with modules that require specific Go versions. It also provides better support for evolving APIs and makes it easier to handle dependencies across different versions of Go.
Fastly – Our bandwidth partner. Fastly powers fast, secure, and scalable digital experiences. Move beyond your content delivery network to their powerful edge cloud platform. Learn more at fastly.com
Fly.io – The home of Changelog.com — Deploy your apps and databases close to your users. In minutes you can run your Ruby, Go, Node, Deno, Python, or Elixir app (and databases!) all over the world. No ops required. Learn more at fly.io/changelog and check out the speedrun in their docs.