Home > Article > Backend Development > Is there any difference between golang and go language?
There is no difference between golang and go language. golang is an alias of go language. Go (also known as Golang) is a statically strongly typed, compiled, concurrent programming language with garbage collection capabilities developed by Google.
Description
Go's syntax is close to C language, but the declaration of variables is different. Go supports garbage collection. Go's parallel model is based on Tony Hall's Communicating Sequential Process (CSP). Other languages that adopt a similar model include Occam and Limbo, but it also has features of Pi operations, such as channel transmission. Plugin support is opened in version 1.8, which means that some functions can now be dynamically loaded from Go.
Compared with C, Go does not include functions such as enumeration, exception handling, inheritance, generics, assertions, virtual functions, etc., but it adds slice type, concurrency, pipes, garbage collection, Language-level support for features such as interfaces. The Go 2.0 version will support generics, but has a negative attitude towards the existence of assertions, and also defends that it does not provide type inheritance.
Unlike Java, Go has built-in associative arrays (also known as hash tables (Hashes) or dictionaries (Dictionaries)), just like the string type.
Features of golang
Concise syntax
Go language is simple and easy to learn, with a gentle learning curve and no need to be like C/C Languages often require two to three years of learning. Go language is called "C language of the Internet era". The style of Go language is similar to C language. Its syntax has been greatly simplified based on the C language, and unnecessary expression brackets have been removed. The loop has only one expression method, for, which can realize various traversals such as numerical values and key values.
Uniform code style
Go language provides a set of formatting tools-go fmt. Some Go language development environments or editors will use formatting tools to modify the format of the code when saving, thus ensuring that the code submitted by different developers is in a unified format.
Good execution performance
Go language is a compiled language. The code we write is directly compiled into a binary executable file that can be executed by the server.
High development efficiency
Although Go language is a compiled language, it has a built-in garbage collection mechanism, which reduces the mental burden on developers and makes it more efficient. It has the same development efficiency as interpreted languages such as Python and PHP. It truly achieves the perfect combination of development efficiency and execution efficiency.
Born to support concurrency
Go was released in 2009, when multi-core processors were already on the market. The Go language has native design advantages in multi-core concurrency. The Go language natively supports concurrency from the bottom up, without the need for third-party libraries, developers' programming skills and development experience.
Writing style
There are several regulations in Go, and these are mandatory. Compilation will occur when the following regulations are not matched. mistake.
There is no need to write a semicolon (;) after each line of the program.
Braces ({) cannot be placed in new lines.
if judgments and for loops do not need to be enclosed in parentheses.
Go also has a built-in gofmt tool, which can automatically clean up excess whitespace in the code, align variable names, and convert aligned spaces into tabs.
Compiler
There are currently two Go compiler branches, namely the official compiler gc and gccgo. The official compiler was initially written in C and later rewritten in Go to achieve bootstrapping. Gccgo is a Go compiler using standard GCC as a backend.
The official compiler supports cross-platform compilation (but does not support CGO), allowing source code to be compiled into binaries that can be executed on the target system and architecture.
Recommended learning: Golang tutorial
The above is the detailed content of Is there any difference between golang and go language?. For more information, please follow other related articles on the PHP Chinese website!