Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Go Languages Reviews     - Nine trick to let you speed up the old machine running Ubuntu Linux (Linux)

- Elementary OS Freya global menu (Linux)

- To use slay kill user processes (Linux)

- Function Getting the Linux shell (Programming)

- Wireshark basic introduction and learning TCP three-way handshake (Linux)

- Linux iostat command example explanation (Linux)

- Linux - Common process the command (Linux)

- RedHat Linux source code package installation process (Linux)

- Node.js Getting the basics: Helloworld! (Linux)

- jQuery update the content and method of use 3.0 (Programming)

- JavaScript is implemented without new keywords constructor (Programming)

- Introduces Linux kernel compilation system and compiler installation (Linux)

- Let the router be your security barrier against external attack (Linux)

- Linux installation Jetty deployment under RedHat5 8 (Linux)

- Java in the final qualifier (Programming)

- RedHat virtual machine to install VMware Tools (Linux)

- Linux command binlog by filtering out the complete SQL statement (Database)

- Ubuntu is expected to allow you to install the latest Nvidia Linux drivers easier (Linux)

- Boot automatically remove Linux operating history records (Linux)

- Ubuntu 14.04 build Gitlab (Linux)

  Go Languages Reviews
  Add Date : 2018-11-21      
  13 In the first half of contact Golang, very fond of Golang. It is 2015, a few days away from the Spring Festival, from the beginning to learn a year and a half now, the back and forth with Golang also write some code, including your spare time, there are products in the project. The idea has been to write a summary of the relevant Golang or feelings, I decided to summarize it in years. Under state: I just Golang preference, not a brain residual powder has no intention to provoke what the language dispute.

Characteristic small and simple grammar. GO is advocating minimalist, advocate less is more. This is in particular to highlight its Spec, an afternoon can definitely read. Characteristics GO little, a lot of users are feedback GO, GO keyword can remember at least in the brain. While its syntax is very simple and clear semantics.

Ease of deployment. GO is a strongly typed static language, code can be compiled to native machine instructions. It RUNTIME is at compile time link together into the executable file, which means that we do not need to install a JVM like JAVA. And compile the executable file itself is not dependent on other DLL can be done easily released. Of course, if you use the GO written call some dynamic library interface code, you still need to deploy the DLL according to the actual situation. This is in many from python / java to go my friends, very much.

There is a better and more robust standard library. GO with standard library itself is more comprehensive, from document archiving, compression, encryption, database data serialization, character formatting and testing, and network libraries, library sync everything. Basically able to meet many basic needs. Even better, the quality of these standard libraries are very high, very strong. The interface is relatively simple, there is clearly documented. Meanwhile, with two years of development, GO third-party libraries have sprung up, though probably not as much as the python, but less time for its development, is still very good.

Integration testing framework. When before writing code in C ++, write unit tests it is not an easy task. It requires some skill and effort before they can do it. However, integrated unit testing framework in the GO, as long as the source file to _test.go end, you can directly go test execution unit tested. It also offers code coverage testing tool, you can easily implement automated testing. In addition, it incorporates benchmarking framework function, you can easily write their own operating efficiency measurement function. In addition, performance profiler, you can run, test analysis bottleneck point in the program, and thus can be optimized.

Sound and style code checking tool. GO had to learn, a lot of articles and books will mention this go fmt command, unified code style. I felt this really solve the style of the other. The impact of the code is written by someone else wrote it myself feeling is the same. There golint, go team can follow the style and requirements to write code. There go vet can be used to check some very subtle GO pit.

Simple but powerful package management. GO package management package management may be in many other languages ​​it seems weak, but in my opinion, it solves two problems I need, is a circular dependency issue, GO package is rejected there is a circular dependency relationship; Second, the initialization packet, each packet can achieve a document init function to execute when importing. This is very useful when the division of labor.

Easy to write cross-platform code. If you use pure GO, do not involve CGO, you can be very easy to do cross-platform. Just before the file suffix .go, introduced _linux, _windows, _x86, _x64 characters such as the end of the file name prefix can be done only compiled in the corresponding platform. GO also build constraints control code compilation under what conditions. If you use the CGO, will involve a cross-platform C, so it is some little trouble, but the problem is not too large.

Garbage collection. GC presence greatly reduces the writing concurrent code, but also provides a robustness of the program. ++ From the start as a C / C, have been driving the development of experienced programmers, GC this thing that I have not covered before. For me GC is equivalent to a nightmare. But when I began to try to find acceptable GC, GC really solve the programmer productivity, greatly improving efficiency. Although it has GO 1.4 version, but may not be on GC still outstanding, in accordance with GO roadmap, will be behind the GC to achieve better added.

Interface struct. In the first study of GO interface, my first reaction is that this is what I want. Although many people are saying GO this interface is not good, but said makes sense, such as Zhao's "Why I do not like the language GO style interface." interface can be extended to a combination of the new interface, struct combination can also be extended to the new struct. Not inherited, only the combination. You can achieve a similar effect by anonymous inherited portfolio. Interface can be queried, somewhat similar to the COM taste, but easier on the grammatical level. struct to interface mappings are implicit, not need to declare a struct implements an interface. While the name may appear on the conflict, but it can be resolved through the wrapper. Another advantage of this interface is very easy to implement MOCK unit testing, it is very fond of. You can also see the article "Go interfaces make test stubbing easy"

Unified work layout. GO defines the directory structure of the project, such as bin directory, pkg directory and src directory. This and my daily project layout is the same. Before using C ++ development when we are so arranged layout, so on this point, I felt easy transition.

Built-in concurrency primitives. GO mentioned have to mention goroutine and channel. Cheap and cheerful goroutine allows us to handle asynchronous tasks, channel can be used to exchange data. With goroutine, you can easily achieve high-performance server. goroutine its scheduler may easily and EPOLL, IOCP mechanism combined with other systems, and through Half Sync / Half Async mode, it is easy to achieve synchronization in the form of syntax level, but without losing performance.

In early 2013, when still doing a client, then use the C ++ 0x, which impressed me most things lambad, std :: function / bind, combined with the thread + queue, it can be very easy to achieve similar Chromuim threading model. In dealing with slow UI tasks such as reading documents, data and other interactive web request, in order to ensure UI experience, these asynchronous tasks is the very necessary. If you have to Golang understanding or familiar friends will understand that this is similar to Golang of goroutine + channel. However, when using this model, still felt a bit tedious, I want to pay attention to the object's life cycle, this in C ++, although there are a variety of smart pointers help, but inevitably will not exhaustive. And encountered a little complicated problems, such as a slow task followed by a slow task, it will involve a task chain, (Facebook folly open source library has a good realization futures in no future / promise, and later also found WINDOWS there actor model-based concurrency library Asynchronous Agents library is very good, but unfortunately currently used only on WINDOWS.) assistance under the mechanism easily enter Callback Hell. This will lead to code relatively difficult to maintain, and easy to breed BUG. Fortunately, this was part of the code is not too much and is not too complicated, it is easy to stabilize by the self-test.

Although the above mentioned future / promise, AAL can solve some problems Callback Hell, but future still like to use callback. So I was wondering if you can do it is on the code level synchronous, asynchronous behind it is just cool. GO would meet my needs.

GO standard library also provides a sync package, including basic mutex he said, there RMutex this read-write lock, as well as Once, WaiterGroup other things. Basically meet the daily needs of the locks.

GO To help programmers to solve the race condition problem often encountered in concurrent, but also provides the appropriate tools to race condition. There are corresponding deadlock detection tool.

Although GO community has a slogan: "do not communicate by sharing memory; instead, share memory by communicating.", But between each goroutine not fully independent, the same can be done through shared memory data. This time can only rely on themselves to abide by the programmer. And because goroutine not fully independent, panic this kind of thing could cause the whole program to hang. This really is not very good and Erlang compared.

Egg pain defer. Accustomed to using the C ++ RAII after disgusted defer GO mechanism, but sometimes they have to use. The reason is that this is not defer block level, but the level of function, it is necessary before the function returns before they get implemented. So this process will result in something like the file open, then close the operation of logic is very boring, back to the C's, you must manually go Close.

Egg pain panic. Although I do not use exceptions, but for the panic that I was very dissatisfied with the design in C ++ ah. Because it will affect the overall situation. And to capture the panic on the need defer. If panic just let the current goroutine hang on Hi skin I felt bad.

Without generics. GO no generic bring boring place, or to use interface {} do runtime generics, or to manually write your own code generator. For example, I own in order to generate network protocol serialization code line and a generator. And because there is no generic, I would like to achieve a similar C ++ STL containers and algorithms basically not too likely, or some method of course, continue to use the code generator. GO1.4 altogether and introduce a call go generate commands.

to sum up

GO inside some other built-in data structures, such as slice, map, etc., but these are also criticized because it was not any give programmers can enjoy benefits range keyword.

In all of the features of the GO, the most favorite is the GC, goroutine, channel and interface. While the remaining features (such as the above I have cited many features) I felt is not too important, many of which are in engineering practice, and not so much the language itself.

To conclude, this thing is an engineering tool for a variety of easy to use, but speaking from a design point of view a variety of rough, no need overvalued. Engineering practice it counted good friend. When writing the service side, it is the weapon, at least when writing server program, I feel so.

A friend said that a language is good to see that there is no open up your horizons and give you new ideas, I think at this point at least GO satisfied.
- Cooling solutions Ubuntu system (Linux)
- Oracle EBS R12 for Linux installation (Database)
- Incremental garbage collection mechanism for Ruby 2.2 (Programming)
- Install the Solaris 10 operating system environment over the network to sparc (Linux)
- Java precision four operations (Programming)
- How do I upgrade from Ubuntu 15.04 to Ubuntu 15.10 (Linux)
- CentOS6.3 build a Python 3.3 environment to access Oracle 11gR2 (Database)
- Linux shell string interception and stitching (Linux)
- Linux Basics Tutorial: Linux Kickstart automated installation (Linux)
- Ubuntu Thunderbird 24.4.0 (Linux)
- Internal class broadcasting needs public and static (Programming)
- pureftpd basis: Install, configure, implement, anonymous logon (Linux)
- error 1819 (HY000): your password does not satisfy the current policy requirements (Database)
- error no.2013 lost connection Tom with SQLServer during query (Database)
- Installation salt-minion on RHEL5 (Linux)
- Java, hashcode, equals and == (Programming)
- State and Linux nf_conntrack TCP disconnect time (Programming)
- Ubuntu 10.10 install Oracle 10g Installation Guide (Database)
- VirtualBox modify the size of the virtual machine disk VDI (Linux)
- MySQL main and backup replication structures (using mysqld_multi) (Database)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.