Home >Backend Development >Golang >what is golang

what is golang

青灯夜游
青灯夜游Original
2022-11-22 10:33:0916445browse

Golang is a statically strongly typed, compiled, concurrent programming language with garbage collection function; it can greatly reduce the complexity of the code without losing application performance, and also It can take advantage of the simultaneous multi-tasking of multi-core processors, solve the troubles of object-oriented programming, and help programmers deal with trivial but important memory management issues.

what is golang

The operating environment of this tutorial: windows10 system, GO 1.11.2, thinkpad t480 computer.

Go language

Go language is a statically strongly typed, compiled language developed by Google in 2007 and officially released to the outside world in 2009 release.

Golang (also known as go language) is a statically strongly typed, compiled, concurrent programming language with garbage collection capabilities developed by Google. It is a simple open source programming language that makes it easy to build simple, reliable, and efficient software.

The Go language can greatly reduce the complexity of the code without losing application performance. It can also take advantage of the simultaneous multi-tasking of multi-core processors, and can solve the troubles of object-oriented programming, and It helps programmers deal with trivial but important memory management issues. Compared with other programming languages, it is simple, fast, safe, parallel, interesting, open source, memory management, array safety, and fast compilation.

The Go language has become popular all over the world with its near-C execution performance, near-analytic language development efficiency, and near-perfect compilation speed. Many people call the Go language the C language of the 21st century, because Go not only has the simplicity and performance of C, but is also optimized for the programming of multi-processor system applications, and provides a good solution for server-side development in the Internet environment of the 21st century. various practical features.

what is golang

The birth of Go language

The event originated in September 2007 At that time, the C committee was giving a sharing speech at Google on the 35 new features added to the C language.

Google’s technical masters are also listening carefully to the lecture. Among them are the three creators of the Go language, namely: Robert Griesemer and Rob Pike. , Ken Thompson (Ken. Thompson).

what is golang

As the meeting came to an intermission, everyone began to complain about whether these

C language new featuresbring more value. Rob Pike believes that:The achievement of simplifying the language is far greater than adding functionality. As a result, a new language, Go, emerged based on this idea.

On September 25, 2007, Rob Pike got inspiration for a new language name on his way home, so he sent an email to two other people:

2-what is golang

The main text of the email is:

I got some inspiration while driving home.

1. Name this programming language "go". It is short and easy to write. Tool classes can be named: goc, gol, goa.

The interactive debugging tool can also be directly named "go". The suffix of the language file is .go, etc.

This is the origin of the name of the Go language. From then on, Robert, Rob and Ken began to conduct research and development within Google. Until 2009, Go Officially open source, the Go project team regards November 10, 2009, the day when the language was officially open sourced, as its official birthday. The source code was initially hosted at http://code.google.com and was gradually moved to GitHub over the next few years.

what is golang

Go language version

Go 1.0 — March 2012: The first version of Go, with a compatibility document to ensure compatibility with future releases without breaking existing programs.

Go 1.1 — May 2013: This version of Go focuses on optimizing the language (compiler, gc, map, go scheduler) and improving its performance.

Go 1.3 — June 2014: This version makes important improvements to stack management. The stack can apply for [continuous memory segments, improving the efficiency of allocation

Go 1.4 - December 2014: This version brings official support for Android, allowing us to write only Go code Simple Android program.

Go 1.7 — August 2016: This version releases the context package, which provides users with methods to handle timeouts and task cancellations.

Go 1.11 — August 2018: Go 1.11 brings an important new feature: Go modules.

Advantages of Go language

what is golang

what is golang

Application fields of Go language

what is golang

Large Internet companies using Go

what is golang

The strength of the Go language is that it is suitable for developing network concurrency services, such as message push, monitoring, containers, etc., so most companies will use it on high-concurrency projects. Golang is preferred as the development language. Another application is to refactor some python, php or java projects. [Related recommendations: Go video tutorial]

Expand knowledge:

What is programming Language

Programming language is a series of instructions (Instruction) used to control the computer. It has a fixed format and vocabulary (the format and vocabulary of different programming languages ​​are different). Just like we Chinese need Chinese to communicate with each other, and British people need English to communicate with each other, communication between people and computers requires a language as a medium, that is, a programming language.

The development of programming languages ​​has gone through machine language (instruction system) => assembly language => high-level language (C, java, Go, etc.).

010010101001-》ADD

  • The computer specifies a set of instructions (two-level code) in the design. The sum of this set of instructions is the so-called machine instruction system. A program written in the form of instructions is called machine language.
  • But because the thousands of instructions in machine language are difficult to remember, and the maintainability and portability are very poor, so on the basis of machine language, people proposed to use characters and decimal numbers instead of binary codes, so Assembly language, which symbolizes machine language, was produced.
  • Although assembly language is much simpler than machine language, assembly language is the symbolization of machine instructions and has a direct correspondence with machine instructions. Whether it is learning or development, it is still very difficult. Therefore, high-level languages ​​that are closer to human language and easier to understand and modify have emerged. A syntax of high-level languages ​​can often replace several, dozens or even hundreds of assembly language instructions. Therefore, high-level languages ​​are easy to learn and use, highly versatile, and widely used.

Compiled language and interpreted language

Computers cannot understand high-level languages, let alone Directly executing a high-level language can only directly understand machine language. Therefore, if a program written in any high-level language wants to be run by a computer, it must be converted into computer language, that is, machine code. This conversion method is divided into two types: compilation and interpretation. Therefore, high-level languages ​​are also divided into compiled languages ​​and interpreted languages.

what is golang

  • Compiled language

Use a specialized compiler to convert the high-level language source code once for a specific platform Compiled into machine code that can be executed by the platform hardware, and packaged into an executable program format that can be recognized by the platform.

Before executing a program written in a compiled language, a special compilation process is required to compile the source code into a machine language file, such as a file in the exe format. When it is run in the future, Just use the compilation result directly, such as running the exe file directly. Because it only needs to be compiled once and does not need to be compiled when running later, compiled languages ​​have high execution efficiency.

1. One-time compilation into platform-related machine language files, which are separated from the development environment during runtime and have high operating efficiency;

2. It is related to a specific platform and generally cannot be transplanted to Other platforms;

  • Interpreted language

Use a specialized interpreter to interpret the source program line by line into machine code for a specific platform and execute it immediately. The code is dynamically translated and executed line by line by the interpreter when it is executed, rather than being translated before execution.

1. Every time an interpreted language is run, the source code needs to be interpreted into machine code and executed, which has low execution efficiency;

2. As long as the platform provides the corresponding interpreter, The source code can be run, so source program transplantation can be facilitated;

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of what is golang. 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