Permalink to this article – https://ift.tt/YthMSXJ
It was planned to write an annual inventory of the Go language years ago, just like 2020 and 2021 . However, just as the domestic epidemic control was relaxed, the body was very prone to fatigue after a wave of sunshine, and there were a lot of things at work, so this inventory has not been written for a long time.
This year’s inventory ideas will revolve around three keywords: generics, boring (boring) and stability . Let’s take a look at them one by one.
1. “Generic” boots land
In mid-March 2022, the Go community, especially those Gophers who are looking forward to adding generic features to Go, finally ushered in the official release of Go 1.18 , which means that the boot of Go generics has finally landed .
In fact, since the day Go was open-sourced, the Go core team has never stopped exploring generics, and has been trying to find an ideal generic design solution, but has never been able to do so. Until recent years, the Go team felt that Go had gradually matured, and it was time to resolve several issues that the Go community was concerned about, including generics, package dependencies, and error handling. Among them, generics dominate the list of “Go language features you want most” in the Go official user survey report all the year round. The following figure is excerpted from the results of the 2020 Go official user survey:
Afterwards, the Go team arranged for Ian Taylor and Robert Grismore to spend more energy on the design of generics, which led to the implementation of the generic syntax features in the Go 1.18 version.
Personally, I think: Go generics is a catering and compromise of the Go core team to the Go community, because generics are contrary to Go’s main design philosophy of “simplicity”. The grammatical feature of generics will bring complexity to the language. This complexity is not only reflected in the introduction of new grammatical elements that are difficult to understand and use at the grammatical level, but also in the support of generics at the type system and runtime levels. complex implementation.
If counting from the Type Functions design proposal proposed by Ian Taylor in June 2010, to the implementation of generics in March 2022, it has been nearly 12 years since Go joined the generics road . But the result is still good. After nearly 12 years of hard work and constant self-denial, the Go team finally found a generic implementation that does not violate the Go1 compatibility promise (see the figure below) :
In this respect, Go’s support for generics is very successful. In the case of such a dramatic change in syntax, backward compatibility is still maintained.
However, if you plan to join the Go camp because Go has added support for generics, here are some friendly reminders: Just like the differences in generic design and implementation between mainstream programming languages that support generics, Go’s generics It is also different from generics in other mainstream programming languages . Before learning Go generics, you can first understand some features that the Go generic design scheme has clearly not supported, such as:
- Does not support generic specialization (specialization), that is, does not support writing a special version of a generic function for a specific type;
- Does not support metaprogramming (metaprogramming), that is, does not support writing code executed at compile time to generate code executed at runtime;
- Operator methods are not supported, that is, only ordinary methods (methods) can be used to operate type instances (for example: getIndex(k)), but operators cannot be regarded as methods and their implementation can be customized, such as a container type The subscript access c[k];
- Variable-length type parameters are not supported;
- …….
These features are not supported now, and there is a high probability that they will not be supported in the future. So friends, especially those from the Java, C++ and other language camps, before you enter the Go generic grammar learning, you must first understand these design decisions of the Go team.
In addition, there is still a gap between the current Go generic implementation and the last version of the generic design scheme . It is still not a complete version, and some features have not been added, and there are still problems to be solved .
As far as the author observes at present, Go generics are still in the early stage, far from mature. It took more than 3 years for the Go module construction mode to be added from go 1.11 to go 1.16 to become the default and gradually mature, not to mention Go generics. From this point of view, it is initially predicted that Go generics will not mature until 2025, and the signs of maturity are nothing more than the following:
- The generic syntax features are determined and stabilized;
- Grammatical problems are basically solved;
- The Go standard library begins to use generics extensively;
- The runtime performance problem of Go generics has been basically solved.
At present, the Go team is still cautious about the application of generics, and is gradually promoting the application of generics in the Go team and the Go community. The latest news is that the Go team has proposed a proposal, which is planned to be implemented with generics in version 1.21 of Go. The maps package and slices package were added to the Go standard library. These two packages were originally planned to be added in Go 1.18, but due to Rob Pike’s suggestion, they were put under golang.org/x/exp to be determined.
2. Boring is good
Unlike other mainstream programming languages such as C++, Rust, etc., new language features in new versions continue to stimulate programmers’ nerves, making everyone excited (exciting) in stages, except for early versions (such as Go 1.1 and Go 1.2) and milestones In addition to the complete bootstrapping of the Go 1.5 version and the significant reduction in GC latency, the go module construction mode of the Go 1.11 version, and the generic landing of the Go 1.18 version, it is difficult for the Gophers to be very excited about the release of most versions, even the industry. Said “Go is boring (Go is boring)” .
At this year’s offline GopherCon conference, Go core team technology leader Russ Cox delivered a keynote speech titled “Compatibility: How Go Programs Keep Working” . In this speech, Russ Cox borrowed the saying that Go is boring, and Said That is good!
Overseas new crown control was released early. After several waves of epidemics, it coexisted with the virus, so the 2022 GopherCon conference resumed offline.
The original words of Russ Cox are: “boring is good. boring is stable. boring means to be able to focus on your work and not ours… We’ll keep doing everything we can to keep go boring for all of you”.
These sentences in English are not difficult, I believe everyone can understand them. Uninteresting Go means stability, which means that everyone focuses on their own work instead of the Go core team (to focus on new features). The Go language does not pile up new features like other programming languages.
This view of Russ Cox represents the core team of Go, and also represents the main tone of the future evolution of Go. At the same time, Russ made a clear conclusion: there will be no Go2 , and Go 1.xy will continue. Russ even suggested that compatibility is the most important feature of Go :
And Russ Cox also gave an extension scheme and an example of backward compatibility and forward compatibility that maintain Go compatibility in the discussion of the Go project.
Regarding “Go is boring”, Russ did not go any further. I remember that I translated an article called “Go language is boring…in fact, it is wonderful!” “ , you can read that article to further understand the meaning of “Go is boring”.
3. “Stability” is the main theme
The stability of Go is not only reflected in the evolution of Go’s grammatical features, but the ranking of Go language in the rankings of major languages has also entered a relatively stable area. Taking TIOBE index as an example, the following is a screenshot of the ranking in December 2022:
I checked the article ” 2021 Go Language Inventory: Strong Armed Forces, Horses and Strong Skills, Ready for a New Journey “. In January 2022, Go ranked 13th. In the above picture, the data that ranked 19th in December 2021 should be a mistake. Yes, compared to December 2021, the actual ranking of Go has risen by 1.
We see Go go from 14 to 13 in 2021 and from 13 to 12 this year. According to the official editor of TIOBE, among emerging programming languages, Go is the only back-end programming language that may break into the top ten in the future.
The performance of the Go language in practical applications is also very consistent with the changes in the above rankings. Generally speaking, it is very stable, and it is calm at home and abroad. The major domestic manufacturers have also used Go. Tencent and Byte are still the same. The leader in this aspect has open sourced many Go-implemented projects successively. The most notable one is that Byte has open sourced the internal Go frameworks one by one, including: netpoll , kitex (rpc framework) , hertz (http framework) , etc.
In order to better help you review the stable evolution of Go this year, here is a brief list of major Go events in 2022 for your reference:
- In March 2022, Go 1.18 version will be officially released
The generic syntax feature that the Go community has been waiting for for years is finally in Go.
- In April 2022, Go officially released the results of the 2021 official Go user survey
It can be seen from the survey results that Gopher’s satisfaction with Go is still as high as 92%; 81% of the respondents are confident in the long-term direction of the Go project.
- In May 2022, the ACM Journal published the article “Go Programming Language and Environment”
This review article of the Go language is jointly written by Russ Cox, Robert Griesemer, Rob Pike, Ian Lance Taylor and Ken Thompson. It is a review of the evolution of Go by the Go core team over the past 10 years . The decisive design philosophy and decision-making is the most important article in the ten years since the birth of Go.
- In June 2022, the uber engineering blog released “Go Language Data Competition Detection and Data Competition Mode”
This article introduces the working principle of ThreadSanitizer v2 and summarizes 7 types of data competition modes.
- In August 2022, Go 1.19 version will be officially released
Compared with Go 1.18, Go 1.19 is a “minor” version. It mainly modifies and optimizes the implementation of generics in Go 1.18, introduces Soft memory limit, and updates the “Go Memory Model” document.
- In September 2022, Go officially reviewed the main improvement points of Go runtime from 2018 to 2022
Including sync.Pool optimization, defer performance improvement, preemptive scheduling based on system signals (go 1.14), scheduler performance improvement, support for register-based calling protocol , soft memory limit, etc.
- In September 2022, Go officially released the govulncheck tool
The security issue of software supply chain has attracted more and more attention from all walks of life. The Go security team released Go’s official security vulnerability management tools and solutions: govulncheck. govulncheck is a front-end of the Go vulnerability database (Go vulnerability database) . It scans the Go source code or compiled Go application executable binary files in your warehouse through the vulncheck package under the vuln warehouse officially maintained by Go to form the source code. Call graph (callgraph) and call stack (callstack).
- In October 2022, GopherCon will be held offline in Chicago
Russ Cox delivered a keynote speech on “Compatibility: How Go Programs Keep Working”, setting the main tone for the future evolution of the Go language.
- November 2022, the 13th birthday of Go open source
Go officials reviewed the work and achievements of the Go team in 2022, and briefly explained the work in the new year, including continuing efforts to make Go the best environment for large-scale software engineering. There are plans to pay special attention to supply chain security, improved compatibility and structured logging ( slog ), and of course there will be many other improvements, including profile-guided optimization and more.
4. Outlook for Go language in 2023
The current evolution and development of the Go language is basically consistent with my prediction in the 2020 Go inventory . I still stick to my judgment, which is what I said in the “Go Language First Lesson” column :
The vast majority of mainstream programming languages will hit their stride in their 15th to 20th year. According to the general law of this programming language, Go, which has passed the 13th year of open source, is likely to enter its golden 5-10 years. The landing of generics in 2022 is the starting point for the Go language to enter the golden 5-10 years. After the generics mature in 2025, Go will achieve faster development speed.
The future is bright, but the road is full of twists and turns. At present, Go is more used in the field of infrastructure, middleware and basic microservices. In terms of enterprise-level business systems, the lack of “family bucket” frameworks such as spring and the inability to reach consensus allow developers to develop complex business systems. Java is still preferred. Looking forward to all the progress in Go on this front.
At the same time, there is another risk in the evolution of Go. In my article “Why Go Can Succeed” , I once mentioned: “Go succeeds with Google, and loses with Google”. The current governance system of the Go team relies too much on Google, which is a double-edged sword. When google develops well, the Go language will benefit from it. But when Google started to go downhill, can Go still be as good as it is today? Let us wait and see!
“Gopher Tribe” knowledge planet aims to create a boutique Go learning and advanced community! High-quality first release of Go technical articles, “three days” first reading right, analysis of the development status of Go language twice a year, fresh Gopher daily 1 hour in advance every day, online courses, technical columns, book content preview, must answer within six hours Guaranteed to meet all your needs about the Go language ecology! In 2022, the Gopher tribe will be fully revised, and will continue to share knowledge, skills and practices in the Go language and Go application fields, and add many interactive forms. Everyone is welcome to join!
I love texting : an enterprise-level SMS platform custom development expert https://51smspush.com/. smspush : A customized SMS platform that can be deployed in the enterprise, covering three networks, not afraid of large concurrent access, and can be customized and expanded; SMS content is determined by you, no longer restricted, rich in interface, supports long SMS, and optional signature. On April 8, 2020, China’s three major telecom operators jointly released the “5G Message White Paper”, and the 51 SMS platform will also be upgraded to the “51 Commercial Message Platform” to fully support 5G RCS messages.
The well-known cloud hosting service provider DigitalOcean released the latest hosting plan. The entry-level Droplet configuration is upgraded to: 1 core CPU, 1G memory, 25G high-speed SSD, and the price is 5$/month. Friends who need to use DigitalOcean, you can open this link address : https://ift.tt/lz1eqFM to start your DO host road.
Gopher Daily (Gopher Daily News) archive repository – https://ift.tt/1pdNeU9
my contact information:
- Weibo (temporarily unavailable): https://ift.tt/uvUsBPC
- Weibo 2: https://ift.tt/l5AZWrF
- Blog: tonybai.com
- github: https://ift.tt/5WfsJHD
Business cooperation methods: writing, publishing, training, online courses, partnerships, consulting, advertising cooperation.
© 2022, bigwhite . All rights reserved.
This article is transferred from https://tonybai.com/2022/12/29/the-2022-review-of-go-programming-language/
This site is only for collection, and the copyright belongs to the original author.