Golang can: 1. Perform server programming; as a server programming language, Go language is very suitable for processing logs, data packaging, virtual machine processing, file systems, distributed systems, database agents, etc. 2. Develop distributed systems, database agents, middleware, etc., such as Etcd. 3. Carry out network programming, including Web applications, API applications, and download applications. Go's built-in net/http package basically implements all the network functions we usually use. 4. Perform database operations. 5. Develop cloud platform.
The operating environment of this tutorial: windows10 system, GO 1.11.2, thinkpad t480 computer.
Introduction to Go language
The Go language (or Golang) originated in 2007 and was officially released in 2009. Go is a very young language, and its main goal is to "combine the development speed of dynamic languages such as Python and the performance and safety of compiled languages such as C/C."
Go language is another attempt at programming language design and a major improvement over C-like languages. It not only allows you to access the underlying operating system, but also provides powerful network programming and concurrent programming support. Go language has many uses and can be used for network programming, system programming, concurrent programming, and distributed programming.
The launch of Go language aims to reduce the complexity of the code without losing application performance. It has the advantages of "simple deployment, good concurrency, good language design, and good execution performance". Currently, many domestic IT companies have adopted Go language to develop projects.
The Go language is sometimes described as a "C-like language", or "the C language of the 21st century". Go inherits similar expression syntax, control flow structure, basic data types, call parameter value transfer, pointers and many other ideas from C language. It also has the running efficiency of compiled machine code that C language has always valued and is consistent with existing Seamless adaptation to the operating system.
Because the Go language does not have the concepts of classes and inheritance, it does not look the same as Java or C. But it achieves polymorphism through the concept of interface. The Go language has a clear and easy-to-understand lightweight type system, and there is no hierarchy between types. Therefore, it can be said that Go language is a hybrid language.
In addition, many important open source projects are developed using the Go language, including Docker, Go-Ethereum, Thrraform and Kubernetes.
Why we choose Go language
There may be many reasons for choosing Go language. Regarding the characteristics and advantages of Go language, we are here A lot has been introduced in previous documents. But the main reason should be based on the following two considerations:
Execution performance
After all, it is a C-like execution speed. For some services, performance is an extremely important part, related to system throughput and access delay, which will in turn affect user experience. Go language can easily implement parallel processing through coroutines to maximize processing efficiency and improve System throughput capacity.
Development efficiency
GO language is easy to use, has high code description efficiency, unified coding standards, and is quick to get started. With a small amount of code, the standardization of the framework can be achieved, various general components and public class libraries can be quickly constructed, further improving development efficiency, and achieving mass production of functions in specific scenarios.
What can the Go language do
The Go language has attracted the attention of many developers since the release of version 1.0 and received Widely used, the simplicity, efficiency, and concurrency features of the Go language have attracted many traditional language developers to join, and the number is increasing.
In view of the characteristics of Go language and the original intention of its design,As a server programming language, Go language is very suitable for processing logs, data packaging, virtual machine processing, file systems, distributed systems, database agents, etc.;In terms of network programming, Go language is widely used in Web applications, API applications, download applications, etc.;In addition,Go language is also suitable for in-memory databases and cloud In the platform field, many foreign cloud platforms are currently developed using Go.
Which companies or projects at home and abroad use it? Go language
After the release of Go, many companies, especially cloud computing companies, began to use Go to reconstruct their infrastructure. Many of them were developed directly using Go. The recently popular Docker was developed using Go. [Related recommendations:Go video tutorial]
There are many open source projects developed using the Go language. Early Go language open source projects only implemented C language library binding with traditional projects through Go language, such as Qt, Sqlite, etc.
Many later projects used Go language for re-native implementation. This process is relatively different from Other languages are simpler, which has also contributed to the emergence of a large number of native development projects using the Go language.
For example, Alibaba Middleware, Jumei Youpin, Gaosheng Holdings, Tantan, Douyu Live, Renrenche, AsiaInfo, Udesk, Fangfutong, Lucky Cat, Sany Group, Meifan.com, etc. The general choice is to choose the product system that is suitable for your company, such as message push, monitoring, container, etc. Golang is particularly suitable for network concurrency services. This is its strength, so it is also used first. for these projects. As a large-scale project development language, Go language has been used in many large companies, and has even completely turned to Go development.
##Write at the end
• Is there a better community? The ecosystems of C, C++, Java, Python and JavaScript are all very rich and popular. Especially communities with many commercial organizations participating are even more popular, such as the Linux community.
• Is there an industrial standard? C, C++, and Java all have standardized organizations. Java, in particular, has developed enterprise-level standards like J2EE in terms of architecture.
• Is there one or more killer apps? Needless to say, the killer applications of C, C and Java, even for PHP, which is not a good programming language, are key technologies in LAMP, the first killer solution in the Linux era, so, also developed. The above three points are very critical. New technologies only need to account for one or two of them to be very good. What's more, some technologies, such as Java, account for all three points. Therefore, the development of Java is so good.
Of course, in addition to the above three important points, there are also other influencing factors, such as:Go language should be middle-layer projects, neither very low-level nor business layer. In other words, the Go language will not swallow up low-level projects such as C and C, nor will it swallow up high-level projects such as the Java business layer. What the Go language can devour must be projects on PaaS, such as some message caching middleware, service discovery, service agents, control systems, agents, log collection, etc. There are no complex business scenarios, and it cannot reach special bottom layers (such as operating systems). ), a software project or tool that is an intermediate platform layer. C and C will be moved to the lower level, and Java will be moved to the upper business layer.
Okay, let’s use the above ruler to measure Docker, the killer application of Go language, and you will find that it is basically the same.Programming Video! !
The above is the detailed content of What can golang do. For more information, please follow other related articles on the PHP Chinese website!