Why use the Go language, where is the go language advantage?

Source: Internet
Author: User
Tags couchbase apcera
This is a creation in Article, where the information may have evolved or changed. transferred from: http://www.zhihu.com/question/21409296
1. What is the advantage of Go
  • Can be directly compiled into machine code, do not rely on other libraries, glibc version has certain requirements, deployment is to throw a file up to complete.
  • Static type language, but there is the feeling of dynamic language, static type of language is can be compiled at the time to check out the most hidden problems, dynamic language feeling is that there are a lot of packages can be used, writing up the efficiency is very high.
  • Language level support concurrency, this is go the biggest feature, innate support concurrency, I once said a word, innate gene and plastic surgery is a difference, everyone is as beautiful, but you like plastic surgery or natural genetic beauty? Go is a gene that supports concurrency, makes full use of multicore, and is easy to use concurrently.
  • Built-in runtime, which supports garbage collection, is one of the features of dynamic languages, although the GC is not perfect at the moment, but it is sufficient to cope with most of the situations we can encounter, especially after Go1.1.
  • Easy to learn, go language authors have a C gene, then go naturally has a C gene, then the GO keyword is 25, but the ability to express is very powerful, almost support most of the features you have seen in other languages: inheritance, overloading, objects and so on.
  • Rich standard library, go now has built up a large number of libraries, especially the network library is very powerful, my favorite is this part.
  • Built-in powerful tools, the go language inside a lot of tool chain, the best should be gofmt tools, automated format code, can make the team review so simple, the code format is identical, it is difficult to think differently.
  • Cross-platform compilation, if you write the go code does not contain CGO, then you can do the window system to compile the application of Linux, how to do it? Go refers to the Plan9 code, which is information that does not depend on the system.
  • Embedded c support, said the author is the author of C, so go inside can also directly contain C code, using the existing rich C library.
2, go suitable for what to do
    • Server programming, if you used C or C + + to do things, go to do a good job, such as processing logs, data packaging, virtual machine processing, file system and so on.
    • Distributed systems, database proxies, etc.
    • Network programming, which is currently the most widely used, including Web applications, API applications, download applications,
    • In-memory database, some time ago Google developed groupcache,couchbase part of the build
    • Cloud platform, at present, many foreign cloud platform in the use of Go development, cloudfoundy part of the formation of the former Vmare technical director himself out to engage in Apcera cloud platform.
3, go successful project
nsq:bitly Open Source Message Queuing system with very high performance, currently they process billions of messages per day
Docker: A virtual packaging tool based on LXC that enables the creation of PAAs platforms.
Packer: Image files used to generate different platforms, such as VMS, VBox, AWS, etc., author of Vagrant
Skynet: Distributed scheduling framework
Doozer: Distributed synchronization tool, similar to zookeeper
Heka:mazila Open-source log processing system
cbfs:couchbase Open Source Distributed File System
Tsuru: Open source PAAs platform, identical to the functionality SAE implements
Groupcache:memcahe written by the author of the cache system for the Google download system
God: A Redis-like caching system, but with distributed and scalable support
Gor: Network traffic capture and replay tool
Here are some companies, just a few:
  • http:// apcera.com
  • / http stathat.com
  • Juju at Canonical/ubuntu, presentation
  • / http Beachfront.io at Beachfront Media
  • CloudFlare
  • Soundcloud
  • Mozilla
  • Disqus
  • / http bit.ly
  • Heroku
  • Google
  • Youtube
listed below are some of the users used
Gousers-go-wiki-a List of organizations that use go.
4, go also existing shortcomings
The following disadvantages are some of the problems I have encountered in project development:
    • Go import package does not support version, sometimes upgrade is easy to cause the project is not operational, so you need to control the corresponding version information
    • Go Goroutine once started, the switch between different goroutine is not controlled by the program, runtime scheduling, need rigorous logic, otherwise goroutine sleep, over a period of time logic ended, suddenly came out and executed, will lead to logic error and so on.
    • The GC delay is a bit large, I developed the log system hurt once, at the same time concurrency is very large case, processing a large log, the GC is not so fast, memory recovery is not a force, and later through the profile program improved after the improvement.
    • Pkg under the picture processing library a lot of bugs, or the use of mature products good, call these mature libraries ImageMagick interface more reliable


Finally, it is recommended that you learn go, the language is really worth learning, because it can do from the bottom to the front of any work.

learn go words welcome everyone through my book to learn, I have open source on GitHub:
Astaxie/build-web-application-with-golang GitHub

and if you use API development or network development, then I do open source framework Beego may be suitable for you, can be appropriate to learn:
Astaxie/beego GitHub
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.