Go programming language What are the pros and cons? How to determine whether the program should be used when Go?

Click here to see https://developer.aliyun.com/ask/269816?utm_content=g_1000098427

 

We like Go local language

In recent years, the use of the Go language of exploding. It seems that every start-up companies to use it for back-end systems. Developers think it is so popular, there are many reasons behind it.

Go language very fast  Go language is a very fast programming language. Because the language is compiled into machine code Go, therefore, its performance will be better than those of natural or interpretive programming language with a virtual runtime. Go program compilation speed is also very fast, and the resulting binary file is very small. Our API to compile complete in just a few seconds, the resulting executable only a mere 11.5MB so small.

Easy to learn  compared to other languages, the Go language syntax is simple, easy to grasp. You can put most of the Go language grammar in your head, which means you do not need to spend a lot of time to find something. Go language is also very clean and easy to read. Go language non-programmers, especially those programmers accustomed to C-style syntax, you can read Go program code and be able to understand what was happening.

Statically typed language definition of  the Go language is a powerful statically typed language definitions. Basic types, such as int, byte and string. There are also structural types. As with any strong typed language, the type system allows the compiler to help catch errors entire class. Go language also has a built-in list and map types, but they are also easy to use.

Interface Type  Go language has an interface type, any structure can be easily met by the interface method implementation of the interface. This allows you decouple dependencies in the code. Then, you can simulate your dependencies in the test. By using the interface, you can write more modular testable code. Go language also has a first-class function, which allows developers to write code more practical way possible.

Standard Library  Go language has a pretty good standard libraries. It provides a convenient built-in functions for handling basic types. Some packages allow you to easily build a Web server, handling I / O, use of encryption technologies and operating raw bytes. The standard library provides JSON serialization and de-serialization very simple. By using "tags", you can specify the JSON field name in the field next to the struct.

Test support  testing support built into the standard library, no additional dependencies. If you have a file named thing.go, please write tests in another file named thing_test.go in, and run the "go test". Go Fast will perform these tests.

Static analysis tools  numerous and powerful static analysis tools Go language. A special tool is gofmt, it is formatted according to the code Go suggestion style. It can regulate many of the comments of the project, so team manager award focused on the work done by the code. We build on each run gofmt, golint and vet, if you find any warning, then the build will fail.

Garbage collection  in the design of the Go language, memory management intends to design than C and C ++ easier. Dynamically allocated object is garbage collection. Go language makes use of pointers is more secure because it does not allow pointer arithmetic. Methods of using value types of options.

Easier concurrency model  although concurrent programming is never an easy task, but the Go language other than the language in concurrent programming easier. Creating a lightweight thread called "goroutine", and through the "channel" for communication is almost very simple things with it, as for more complex models, also may be able to achieve.

 

We do not like the language of the local Go

 

As we discussed earlier, Go language is indeed a good language. It has a clean syntax, execution speed is very fast. It also has many advantages. However, all of the programming language and not just refer to its syntax. The following are some of the problems we encountered.

Keywords: GO programming language

Guess you like

Origin www.cnblogs.com/wanghonghong/p/12155940.html