Featured image of post Go Language Recap in 2023:Steady Progress with Innovation and Adaptation

Go Language Recap in 2023:Steady Progress with Innovation and Adaptation

 

Time flies, and in the blink of an eye, it’s already the last day of 2023. Looking back on this year, the world has fully recovered from the COVID-19 pandemic, and the Go language is no exception. One of the most noticeable changes is the significant transition of GopherCon conferences and small meetups around the world from being held online or canceled to being held in person. This shift signifies the progress and normalcy returning to the Go community. These events, such as GopherCon, GopherCon UK, GopherCon Europe, GopherCon Australia, and Golab, have received enthusiastic participation and warm welcomes from Gophers worldwide.

This article was first published in the Medium MPP plan. If you are a Medium user, please follow me on Medium. Thank you very much.

Of particular note is the largest Gopher conference in China, GopherChina 2023. To meet the needs of Gophers in different regions, the GoCN community organized two GopherChina conferences in Beijing and Shanghai in June and November, respectively, for the first time in history.

Even the “father of Go,” Rob Pike, who has already taken a back seat, personally participated in these conferences to promote the development of the global Go community and ecosystem. He delivered a keynote speech titled “What We Got Right, What We Got Wrong” at GopherCon Australia 2023, reflecting on the successes and failures of Go since its inception.

As the experts reflect on their lifetime achievements, let’s take stock of the year together. In this article, we will discuss the state of Go in 2023, its position in the programming landscape, and the mechanisms and strategies for its future evolution.

1. Go in 2023

1.1 Stability

As in previous years, Go released two major versions in 2023: Go 1.20 in February and Go 1.21 in August. These versions continued the tradition of stability in Go’s syntax features. While there were improvements, such as support for type conversion from slice types to array types (or pointers to array types), most of the changes focused on fixing and refining the syntax. For example, the “comparable” feature relaxed the restrictions on generic arguments, the unsafe package added more “syntactic sugar,” and there were additions like the min, max, and clear built-in functions, as well as enhanced type inference capabilities.

These changes didn’t come as a surprise to Gophers because they align with the spirit of “Go is boring” proclaimed by Russ Cox in 2022.

However, apart from the relatively modest changes in syntax features, Go continued to seek innovation and adaptation in other areas. Let’s take a look at how Go pursued innovation.

Note: The pursuit of innovation and adaptation may intersect and have some fuzzy boundaries. They can also mutually reinforce each other. Please read the following content without nitpicking. :)

1.2 Innovation

While maintaining stability in syntax features, Go made efforts to optimize and refine its compiler, toolchain, runtime, and standard library. The goal was to enhance both productivity and runtime efficiency, and many of the optimizations and refinements introduced were novel.

For example, Go 1.20 introduced the preview version of PGO (profile-guided optimization), which became the default setting in Go 1.21. According to the official data, PGO optimization brought performance improvements ranging from 2% to 7%. In the latest Go 1.22rc1, this number has increased to 2% to 14%.

In terms of memory management, although the experimental feature “arena package” introduced in Go 1.20 didn’t make it to the stable release in Go 1.21 and is currently in the proposal-hold state, it represents an innovative approach to memory management.

Go is a programming language focused on software engineering, and in 2023, it made several innovations in this field. For example, the “gonew” tool, which simplifies Go project creation, gained popularity. It allows developers to clone and create their own Go projects based on go project templates. Another example is the collection of code coverage during application execution, which helps developers gain a deeper understanding of test coverage along the code execution paths. The “govulncheck” tool is an attempt to address software supply chain security in Go, enriching the means of checking security vulnerabilities in Go projects.

Note: Regarding software supply chain security, Russ Cox recently gave a dedicated talk titled “Open Source Supply Chain Security at Google.” Interested readers can learn more from it.

Go has always been open to new technologies, trends, and ideas from the community. As early as the emergence of WASM, Go provided support for wasm porting. In Go 1.21, Go also added support for WASI (WebAssembly System Interface), which has not yet formed a final specification.

The feedback from the Go community is also a source of innovation for the Go team. A typical example is the inclusion of “log/slog” in the standard library, which enables native support for structured logging with performance comparable to third-party open-source log packages like “zap.”

The Go community has followed the pace set by the Go team and embarked on the path of innovation. In 2023, one of the biggest events in the IT industry was the emergence of large language models represented by ChatGPT. This event is likely to be a significant milestone in human civilization’s progress. The use of large models has become a hot topic in various fields, and AI has become a buzzword. In the field of traditional machine learning, deep learning, and neural networks, where the ecosystem for Go is not as rich, Go has been exploring and integrating with large models. For example, the “ollama” open-source project, which enables fast local launch and execution of models like llama2, mistral 7B, codellama, and vicuna, has gained nearly 30k stars in just a few months. Additionally, Google open-sourced the “Google AI Go SDK” to support integration with various large model projects, providing detailed tutorials on how Gophers can interact with large models through the SDK.

Note: Google has made the Gemini Pro API free for individual users. This model has the capabilities of GPT 3.5, with 32k context, support for 38 languages, and multimodal capabilities, with the only constraint being a limit of 60 requests per minute.

In the second Go user survey in 2023, Go developers expressed interest in AI/machine learning tools that improve code quality, reliability, and performance, rather than tools for writing code itself. An AI developer assistant that acts as a vigilant and always available expert reviewer may be a more helpful form of AI assistance. The Go team has shown its commitment to this survey, and AI integration may become a regular part of the Go toolchain in the future.

1.3 Adaptation

In August 2023, shortly after the release of Go 1.21, the official Go blog published two articles written by Russ Cox: “Backward Compatibility, Go 1.21, and Go 2” and “Forward Compatibility and Toolchain Management in Go 1.21.” These articles clarified the scope and approach of Go’s backward compatibility and presented the specific plan for forward compatibility for the first time. These articles laid the theoretical foundation for Go’s future “adaptation.”

In terms of backward compatibility, starting from Go 1.21, Russ Cox proposed measures such as expanding and standardizing the use of GODEBUG. The general idea is as follows:

  • For new features/changes within the scope of Go 1 compatibility that may break existing code (e.g., changes to the semantics of panic(nil)), Go will add a new option to the GODEBUG environment variable (e.g., GODEBUG=panicnil=1) to preserve compatibility with the original semantics during compilation.
  • Newly added options in GODEBUG will be retained for at least two years (four Go release versions). Some options that have a significant impact (e.g., http2client and http2server) may be retained even longer or indefinitely.
  • The options set in GODEBUG match the go version specified in go.mod. For example, even if you have Go 1.21 as your toolchain, if the go version in go.mod is 1.20, the new feature semantics controlled by GODEBUG will not take effect and will maintain the behavior of Go 1.20. The new feature semantics will only take effect when you upgrade the go version in go.mod to go 1.21.0.
  • In Go 1.21 and later versions, in addition to using environment variables like GODEBUG=panicnil=1 to restore the original semantics, you can also use the //go:debug directive in the main package.

Regarding forward compatibility, Russ Cox proposed a complex and nuanced plan, which is beyond the scope of this translation. Interested readers can refer to my previous article “Understanding Go’s Forward Compatibility and Toolchain Rule” for more details.

1.3.1 Filling Syntax Gaps

Among Go’s many adaptations, the most significant impact came from “fixing” existing syntax quirks. These “gap-filling” efforts may have had some influence on existing code, and in some cases, even introduced breaking changes. There were voices of opposition within the Go community. However, these changes were already set in motion with the release of Go 1.21. For example, changes to the semantics of panic(nil) and modifications to loop variable semantics, as detailed in the article “Some Changes in Go 1.21 Worth Noting.”

Fixing existing syntax gaps also drove further innovation. For example, while fixing loop variable semantics, work was underway to expand the range of expressions that can be iterated over using the “for range” construct. In Go 1.22, “for range” will support iterating over integer expressions, and experimental support for function iterators was provided.

1.3.2 Standard Library v2 Demonstrations

Go prides itself on being a “batteries included” language, with a high-quality standard library that is widely embraced by Gophers. The Go team has been working continuously to enrich the functionality of the standard library. For example, Go 1.22 introduced enhancements to the http.ServeMux, making it comparable to third-party packages like gorilla/mux in terms of handling wildcard routes.

In Go 1.22, the standard library introduced its first v2 version package: math/rand/v2. This serves as a demonstration for the future evolution of standard library packages using the vN versioning approach. According to discussions in official Go team issues, packages like sync/v2 and encoding/json/v2 are already on the roadmap.

2. Go’s Position

Many people are interested in Go’s current status: How widely is it used in major Chinese tech companies? Are smaller companies also adopting it extensively? I have covered these questions in my previous Go language recaps, so I won’t repeat them here. No major company would completely rewrite their codebase within a year after adopting a language extensively. The adoption of Go by smaller companies also tends to be inertia-driven.

Let’s start with two unexpected “findings” this year.

2.1 Two Unexpected “Discoveries”

In mid-October 2023, Tesla, a world-renowned electric vehicle manufacturer, released a new version of its fleet API and vehicle command SDK. As I work in the smart connected vehicle industry, I took a deeper look into Tesla’s release. To my surprise, I found that Go is now the second most popular programming language in Tesla’s open-source projects on GitHub.

Compared to traditional automakers, Tesla is relatively more open. Openness here has two meanings: openness of vehicle capabilities and openness of projects. While most domestic automakers have yet to open up their vehicle capabilities, Tesla has been open in both aspects. Although their open-source projects are not numerous, they have made efforts to open up vehicle APIs and provide targeted open-source projects. In the past, Tesla used Ruby for cloud service-related projects, but starting from 2022, the use of Go has gradually increased. This includes projects like the Fleet Telemetry reference server implementation for Fleet API and the Tesla vehicle remote control SDK.

Now, let’s take a look at the Apache Software Foundation. As we all know, most Apache projects are primarily written in Java. However, by chance, I came across the GitHub project page of the Apache Software Foundation and found that Go has quietly become the fifth most used language in Apache open-source projects. If we consider only backend languages, Go ranks third, second only to Java and Python.

Moreover, the Apache Software Foundation has a considerable number of Go projects. You can check this link to see the complete list. Among them are outstanding projects such as “answer” for building Q&A knowledge systems, “dubbo-go” as the Go implementation of Apache Dubbo, “trafficcontrol” for CDN implementations, “Camel K” for lightweight enterprise application integration framework native to Kubernetes, “Apache Arrow” Go implementation, and “devlake” for aggregated data platforms for the development process.

Apache projects have a wide range of applications in enterprise-level systems and platforms. The increased use of Go in Apache projects indicates its growing popularity and acceptance in the enterprise application market.

2.2 Go Language Rankings

The competition and controversy among programming languages are often referred to as “programming language wars,” which reflect the collision of different technical communities and paradigms. These heated debates about languages are often subjective. In the past decade, several widely accepted programming language rankings have emerged, which use relatively objective data to reflect the real-world status of different programming languages in development. However, each ranking has different data sources and models, and a single ranking alone cannot provide a complete picture. Currently, there is no authoritative ranking that gives us a comprehensive view. Therefore, to objectively and comprehensively reflect the actual situation of a programming language, we need to refer to multiple rankings.

Now, let’s take a look at the latest rankings for Go language from famous programming language rankings worldwide (please note that the release dates of these rankings may vary, resulting in some time differences in the data).

2.2.1 PYPL Programming Language Rankings

The PYPL (PopularitY of Programming Language) index is created by analyzing the frequency of language tutorials searched on Google. The more tutorials are searched, the more popular the language is. The raw data comes from Google Trends:

PYPL Programming Language Rankings, data as of December 2023

2.2.2 IEEE Spectrum Rankings

The IEEE Spectrum rankings are based on surveys of global software engineers and data from job posting websites to calculate the popularity of various programming languages:

IEEE Spectrum Rankings, data as of August 2023

2.2.3 RedMonk Programming Language Rankings

The RedMonk rankings are based on the number of discussions about languages on GitHub and Stack Overflow, two popular developer communities.

RedMonk Programming Language Rankings, data as of May 2023

2.3.4 GitHub Octoverse

The GitHub Octoverse rankings provide a visual representation of the actual usage and popularity trends of various programming languages on GitHub over the past year. It measures the activity of programming languages based on the number of open-source projects. In the Top 10 languages list, Go surpassed Ruby for the first time and entered the GitHub Top 10 languages:

GitHub Octoverse Programming Language Rankings, data as of November 2023

GitHub Octoverse Programming Language Rankings, data as of November 2023

2.3.5 Github Language Stats (Githut)

Github Language Stats is a personal project that analyzes the usage of programming languages on GitHub based on publicly available data. It provides insights into language usage on GitHub from various perspectives, such as time, pull request count, and star count:

Githut by PR count, data as of Q3 2023

Githut by star count, data as of Q3 2023

2.3.6 TIOBE Index

TIOBE Programming Language Index is theoretically the most well-known programming language ranking in the world. It calculates a comprehensive index based on the search query volume related to programming languages on major search engines. However, the fluctuating data of the TIOBE rankings in recent years has made developers have a love-hate relationship with this list. Here is the TIOBE index for December 2023:

When you see Fortran ranking ahead of Go, you realize that this ranking is somewhat unreliable.

Based on the above six rankings, we can see that Go language remained in a stable development state in 2023, without making significant strides forward or unexpected setbacks.

This year, there have been discussions on some online platforms in China about whether Go has cooled down. Based on the actual situation mentioned above, those negative views about Go can be easily refuted. Some may argue that the rising popularity of Rust will have a certain impact on Go, and this cannot be denied. Just like how Go quickly rose and brought some impact to Java in the past, it is a natural process for a programming language to experience such challenges during its evolution. Five years later, Rust may also face challenges from other languages.

The future of Go depends on the Go team’s grasp of its future direction and the strength of the Go community and ecosystem. In 2023, the Go team also clarified the future evolution mechanism and strategy, so let’s take a look.

3. The Future Evolution of Go

2023 marked the 14th year of Go’s open-source existence, and Go has long shed its youthful awkwardness and entered its adolescence. This means that it has become more mature and stable in terms of language features, and its ecosystem has become increasingly rich and complete. As a language in its prime, Go demonstrates a highly engineering-oriented mindset in system design, making it capable of handling complex system construction with ease. The modular support primarily provided by Go modules helps clarify large-scale programs, and its rich concurrency control mechanisms enable it to handle massive requests. At the same time, the Go language ecosystem is flourishing, with various high-quality frameworks emerging, numerous reusable modules available, and a wealth of cloud-native components to choose from. This greatly reduces the workload for developers to build systems from scratch.

Just like us humans, the mature characteristics of a language in its adolescence cannot completely conceal its uncertainty about future evolution! After the retirement of Ken Thompson and Rob Pike, Russ Cox became the “helmsman” of the Go ship. Russ Cox’s thoughts on programming languages and his judgment of Go’s values will directly determine the course of Go’s future.

Fortunately, at the GopherCon conference in 2023, we got the answer from Russ Cox: it is “decision-making based on shared goals and data-driven insights”. Let’s take a look at the specific evolution driving mechanisms based on the conclusions presented by Russ Cox in his speech:

  • First, Go needs to keep evolving, especially with the changes in the computing world.
  • Second, the goal of any change is to make Go better in software engineering, especially in terms of scaling.
  • Third, once we have determined the goals, the next crucial step is to have shared data for decision-making.
  • Fourth, Go toolchain telemetry is an important source of additional real-world Go usage data to supplement our existing surveys and code analysis data.

Based on the above, the Go team aims to “embrace change” but not make haphazard changes like a headless fly. Instead, they rigorously base their decisions on extensive data feedback, including user surveys, user feedback from VSCode plugin usage, research interviews conducted throughout the year, user experience research, and more. They also gather more accurate Go usage data through the optional telemetry feature that will be added to the Go toolchain.

With the addition of the optional telemetry feature to the Go toolchain, the Go team will have more precise decision-making based on user data, ensuring that the Go ship continues to sail in the right and bright direction!

4. Conclusion

In 2023, Go language continued to maintain its stability and reliability. Two major versions were released, Go 1.20 and Go 1.21, with relatively few changes in syntax features, focusing on bug fixes and optimizations. However, Go language still maintains a spirit of innovation and change in other aspects.

The Go language team is committed to optimizing the compiler, toolchain, runtime, and standard library to enhance productivity and runtime efficiency. They have introduced new features and optimization measures, such as the introduction and improvement of profile-guided optimization (PGO) technology and advancements in memory management. At the same time, Go language has also made innovations in the field of software engineering, including the gonew tool for simplifying project creation, code coverage collection tools, and the govulncheck tool for supply chain security.

Go language has always maintained an open attitude towards new technologies, trends, and communities. In 2023, Go’s support for WASM and WASI was further strengthened. At the same time, the Go community actively responds to and follows the pace of the Go team. Faced with emerging technologies like large language models in the IT industry, the Go community continues to explore and apply them.

Overall, 2023 was a year of stability and innovation for Go language. Go language maintains its characteristics of simplicity, efficiency, and ease of use, while actively adapting to and adopting new technologies and demands, providing developers with a better development experience and tool support.

Looking ahead, the Go team has clearly defined an evolution mechanism driven by consensus and user data, ensuring that Go’s development direction remains in sync with practical needs. With the addition of the optional toolchain telemetry feature, they can make more accurate and forward-looking decisions based on richer user data.

I personally still hold my previous judgment: Go will enter or may already be in its golden 5-10 years.

This article is a translation of a Chinese blog post written by tony bai. The original article can be found here.

true
Last updated on Jun 29, 2024 20:30 CST
Built with Hugo
Theme Stack designed by Jimmy