Go的16岁生日
Go's Sweet 16

原始链接: https://go.dev/blog/16years

## Go 编程语言:16 周年与近期更新 Go 庆祝其开源发布 16 周年,并继续关注生产力、安全性和适应人工智能的兴起。1.24 和 1.25 版本带来了新的 API、安全增强(包括密码学软件包的 FIPS 140-3 认证)以及底层改进,例如重新设计的 map 实现。 一项关键创新是 `testing/synctest` 包,它通过虚拟化时间简化了并发代码的测试。测试包也收到了更新,具有更易于使用的基准测试工具。Go 1.25 引入了容器感知调度,以提高容器化环境中的性能,并提供了一个“飞行记录器”用于详细的生产调试。 Go 团队正在积极探索人工智能集成,发布了模型上下文协议 (MCP) 的 SDK,并与代理开发框架合作。Go 1.26 将带来垃圾收集器(“Green Tea”)的重大改进,有望将开销降低高达 40%。 持续的开发包括对 `gopls` 语言服务器的增强,以及对核心库(如 `encoding/json`)的升级。该项目还专注于扩展其开发流程并加深社区参与,以实现持续增长和创新。

## Go 编程语言迎来 16 周年 一篇最近的 Hacker News 帖子强调了 Go 编程语言 (go.dev) 在 16 周年之际持续的吸引力。用户称赞 Go 速度快且易于学习,一位开发者回忆说,采用 Go 后,其他语言中解析速度慢的挫败感很快得到解决。 该语言简洁的规范被认为是其快速普及的关键因素。一位评论员甚至认为 Go 只需付出 20% 的努力就能实现 Rust 80% 的功能。 进一步证明 Go 的实用性,分享了一个为 Go 后端开发者准备的 10 周入职培训计划,以及一位开发者分享的成功案例,他认为他们的初创公司七年前从 Python 切换到 Go 取得了成功。
相关文章

原文

This past Monday, November 10th, we celebrated the 16th anniversary of Go’s open source release!

We released Go 1.24 in February and Go 1.25 in August, following our now well-established and dependable release cadence. Continuing our mission to build the most productive language platform for building production systems, these releases included new APIs for building robust and reliable software, significant advances in Go’s track record for building secure software, and some serious under-the-hood improvements. Meanwhile, no one can ignore the seismic shifts in our industry brought by generative AI. The Go team is applying its thoughtful and uncompromising mindset to the problems and opportunities of this dynamic space, working to bring Go’s production-ready approach to building robust AI integrations, products, agents, and infrastructure.

First released in Go 1.24 as an experiment and then graduated in Go 1.25, the new testing/synctest package significantly simplifies writing tests for concurrent, asynchronous code. Such code is particularly common in network services, and is traditionally very hard to test well. The synctest package works by virtualizing time itself. It takes tests that used to be slow, flaky, or both, and makes them easy to rewrite into reliable and nearly instantaneous tests, often with just a couple extra lines of code. It’s also a great example of Go’s integrated approach to software development: behind an almost trivial API, the synctest package hides a deep integration with the Go runtime and other parts of the standard library.

This isn’t the only boost the testing package got over the past year. The new testing.B.Loop API is both easier to use than the original testing.B.N API and addresses many of the traditional—and often invisible!—pitfalls of writing Go benchmarks. The testing package also has new APIs that make it easy to cleanup in tests that use Context, and that make it easy to write to the test’s log.

Go and containerization grew up together and work great with each other. Go 1.25 launched container-aware scheduling, making this pairing even stronger. Without developers having to lift a finger, this transparently adjusts the parallelism of Go workloads running in containers, preventing CPU throttling that can impact tail latency and improving Go’s out-of-the-box production-readiness.

Go 1.25’s new flight recorder builds on our already powerful execution tracer, enabling deep insights into the dynamic behavior of production systems. While the execution tracer generally collected too much information to be practical in long-running production services, the flight recorder is like a little time machine, allowing a service to snapshot recent events in great detail after something has gone wrong.

Secure software development

Go continues to strengthen its commitment to secure software development, making significant strides in its native cryptography packages and evolving its standard library for enhanced safety.

Go ships with a full suite of native cryptography packages in the standard library, which reached two major milestones over the past year. A security audit conducted by independent security firm Trail of Bits yielded excellent results, with only a single low-severity finding. Furthermore, through a collaborative effort between the Go Security Team and Geomys, these packages achieved CAVP certification, paving the way for full FIPS 140-3 certification. This is a vital development for Go users in certain regulated environments. FIPS 140 compliance, previously a source of friction due to the need for unsupported solutions, will now be seamlessly integrated, addressing concerns related to safety, developer experience, functionality, release velocity, and compliance.

The Go standard library has continued to evolve to be safe by default and safe by design. For example, the os.Root API—added in Go 1.24—enables traversal-resistant file system access, effectively combating a class of vulnerabilities where an attacker could manipulate programs into accessing files intended to be inaccessible. Such vulnerabilities are notoriously challenging to address without underlying platform and operating system support, and the new os.Root API offers a straightforward, consistent, and portable solution.

Under-the-hood improvements

In addition to user-visible changes, Go has made significant improvements under the hood over the past year.

For Go 1.24, we completely redesigned the map implementation, building on the latest and greatest ideas in hash table design. This change is completely transparent, and brings significant improvements to map performance, lower tail latency of map operations, and in some cases even significant memory wins.

Go 1.25 includes an experimental and significant advancement in Go’s garbage collector called Green Tea. Green Tea reduces garbage collection overhead in many applications by at least 10% and sometimes as much as 40%. It uses a novel algorithm designed for the capabilities and constraints of today’s hardware and opens up a new design space that we’re eagerly exploring. For example, in the forthcoming Go 1.26 release, Green Tea will achieve an additional 10% reduction in garbage collector overhead on hardware that supports AVX-512 vector instructions—something that would have been nigh impossible to take advantage of in the old algorithm. Green Tea will be enabled by default in Go 1.26; users need only upgrade their Go version to benefit.

Go is about far more than the language and standard library. It’s a software development platform, and over the past year, we’ve also made four regular releases of the gopls language server, and have formed partnerships to support emerging new frameworks for agentic applications.

Gopls provides Go support to VS Code and other LSP-powered editors and IDEs. Every release sees a litany of features and improvements to the experience of reading and writing Go code (see the v0.17.0, v0.18.0, v0.19.0, and v0.20.0 release notes for full details, or our new gopls feature documentation!). Some highlights include many new and enhanced analyzers to help developers write more idiomatic and robust Go code; refactoring support for variable extraction, variable inlining, and JSON struct tags; and an experimental built-in server for the Model Context Protocol (MCP) that exposes a subset of gopls’ functionality to AI assistants in the form of MCP tools.

With gopls v0.18.0, we began exploring automatic code modernizers. As Go evolves, every release brings new capabilities and new idioms; new and better ways to do things that Go programmers have been finding other ways to do. Go stands by its compatibility promise—the old way will continue to work in perpetuity—but nevertheless this creates a bifurcation between old idioms and new idioms. Modernizers are static analysis tools that recognize old idioms and suggest faster, more readable, more secure, more modern replacements, and do so with push-button reliability. What gofmt did for stylistic consistency, we hope modernizers can do for idiomatic consistency. We’ve integrated modernizers as IDE suggestions, where they can help developers not only maintain more consistent coding standards, but where we believe they will help developers discover new features and keep up with the state of the art. We believe modernizers can also help AI coding assistants keep up with the state of the art and combat their proclivity to reinforce outdated knowledge of the Go language, APIs, and idioms. The upcoming Go 1.26 release will include a total overhaul of the long-dormant go fix command to make it apply the full suite of modernizers in bulk, a return to its pre-Go 1.0 roots.

At the end of September, in collaboration with Anthropic and the Go community, we released v1.0.0 of the official Go SDK for the Model Context Protocol (MCP). This SDK supports both MCP clients and MCP servers, and underpins the new MCP functionality in gopls. Contributing this work in open source helps empower other areas of the growing open source agentic ecosystem built around Go, such as the recently released Agent Development Kit (ADK) for Go from Google. ADK Go builds on the Go MCP SDK to provide an idiomatic framework for building modular multi-agent applications and systems. The Go MCP SDK and ADK Go demonstrate how Go’s unique strengths in concurrency, performance, and reliability differentiate Go for production AI development and we are expecting more AI workloads to be written in Go in the coming years.

Go has an exciting year ahead of it.

We’re working on advancing developer productivity through the brand new go fix command, deeper support for AI coding assistants, and ongoing improvements to gopls and VS Code Go. General availability of the Green Tea garbage collector, native support for Single Instruction Multiple Data (SIMD) hardware features, and runtime and standard library support for writing code that scales even better to massive multicore hardware will continue to align Go with modern hardware and improve production efficiency. We’re focusing on Go’s “production stack” libraries and diagnostics, including a massive (and long in the making) upgrade to encoding/json, driven by Joe Tsai and people across the Go community; leaked goroutine profiling, contributed by Uber’s Programming Systems team; and many other improvements to net/http, unicode, and other foundational packages. We’re working to provide well-lit paths for building with Go and AI, evolving the language platform with care for the evolving needs of today’s developers, and building tools and capabilities that help both human developers and AI assistants and systems alike.

On this 16th anniversary of Go’s open source release, we’re also looking to the future of the Go open source project itself. From its humble beginnings, Go has formed a thriving contributor community. To continue to best meet the needs of our ever-expanding user base, especially in a time of upheaval in the software industry, we’re working on ways to better scale Go’s development processes—without losing sight of Go’s fundamental principles—and more deeply involve our wonderful contributor community.

Go would not be where it is today without our incredible user and contributor communities. We wish you all the best in the coming year!

联系我们 contact @ memedata.com