Home  >  Article  >  What does golang do?

What does golang do?

zbt
zbtOriginal
2023-06-13 11:44:172308browse

Golang is a very young language. Its main goal is to combine the development speed of dynamic languages ​​such as Python with the performance and security of compiled languages ​​such as C/C. 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. Go language is widely used in Web applications, API applications, download applications, etc. In addition, Go language is also suitable for in-memory database and cloud platform fields. Currently, many foreign cloud platforms are developed using Go.

What does golang do?

The operating environment of this tutorial: windows10 system, golang1.20.1 version, DELL G3 computer.

What is golang?

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 "have both Python and The development speed of dynamic languages ​​and the performance and security of compiled languages ​​such as C/C".

Go language is another attempt at programming language design and a major improvement to C-like languages. It can not only It allows you to access the underlying operating system and 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 , which 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 The company has 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 It inherits many ideas from C language such as similar expression syntax, control flow structure, basic data types, call parameter value transfer, pointers, etc., as well as the running efficiency of compiled machine code and existing operations that C language has always valued. Seamless adaptation of the system.

Because Go language does not have the concepts of classes and inheritance, it is the same as Java or C They don't look the same. 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 have also already mentioned it in previous documents A lot has been introduced. But the main reason should be based on the following two considerations:

Execution performance

After all, it is C-like execution speed. For some services, performance is an extremely important part. , related to the system throughput and access delay, which will in turn affect the user experience. The Go language can easily implement parallel processing through coroutines to maximize processing efficiency. , improve the throughput capacity of the system.

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 and has been widely used since the release of version 1.0. The simplicity, efficiency, and concurrency features of the 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, Go language, as a server programming 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 on the Web Applications, API applications, downloaded applications, etc.; in addition, Go language is also suitable for in-memory database and cloud platform fields. Currently, many foreign cloud platforms are developed using Go.

What does golang do?

Server programming, if you used C or C to do those things before, Go is very suitable to do it, such as log processing, data packaging, virtual machine processing, file system wait.

Distributed systems, database agents, middleware, etc., such as Etcd.

Network programming is currently the most widely used area, including Web applications, API applications, and download applications. Moreover, Go’s built-in net/http package basically implements all the network functions we usually use.

Database operation

Develop cloud platform. Currently, many foreign cloud platforms are using Go for development

What enterprises or projects at home and abroad use Go language

Go After its release, 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 recommendation: Go video tutorial]

There are many open source projects developed using 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 projects in the later period 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 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.

Written at the end

Of course, whether a technology can be developed depends on three key points. (The following views are quoted from https://www.cnblogs.com/qwangxiao/p/8318894.html)

• Is there a better community? Like C, C++, Java, Python and JavaScript The ecosystem is 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 a killer app or apps? Needless to say, the killer applications of C, C and Java, even for PHP, which is not a good programming language, because it is Therefore, the key technologies in LAMP, the first killer solution in the Linux era, have 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:

Whether the learning curve is low and whether it is fast to get started. This is very important, and C is getting worse and worse at this point.

Is there a good development framework that improves development efficiency? Such as: Java's Spring framework, C's STL, etc.

Whether it is backed by one or more giant technology companies. For example: IBM and Sun behind Java and Linux...

Have they solved the pain points in software development? For example: Java solves the memory management problems of C and C.

Using these rulers to measure the Go language, we can clearly see:

Go language is easy to use;

Go language solves the problem of concurrent programming and low-level application development The pain point of efficiency;

The Go language is backed by Google, a world-class technology company;

The killer application of the Go language is Docker, and the Docker ecosystem has completely exploded in the past few years. .

So, the future of Go language is unlimited. Of course, Go may eat up many C, C, and Java projects. However, Go The main projects swallowed by the language should be middle-layer projects, neither very low-level nor business layer. In other words, the Go language will not swallow the bottom layer to the level of C and C, nor will it swallow the high-level language such as Java business layer project. What the Go language can devour must be PaaS Projects on the Internet, such as some message caching middleware, service discovery, service agents, control systems, agents, log collection, etc., have no complicated business processes. In business scenarios, software projects or tools at the middle platform layer of the special bottom layer (such as the operating system) cannot be reached. 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. You will find that it is basically the same.

Docker is easy to get started with.

Docker solves the environmental problems in operation and maintenance and the pain points of service scheduling.

Docker’s ecosystem has big companies behind it. Such as Google.

Docker produces the industry standard OCI.

Docker’s community and ecosystem have already seen a trend similar to that of Java and Linux.

The above is the detailed content of What does golang do?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn