Home  >  Article  >  Backend Development  >  What are the benefits of go language

What are the benefits of go language

青灯夜游
青灯夜游Original
2023-02-02 17:28:287153browse

Benefits of go language: 1. It can be directly compiled into machine code and does not rely on other libraries; 2. It is a statically typed language, but it has the feeling of a dynamic language and is very efficient to write; 3. Language level support Concurrency; 4. Built-in runtime, supports garbage collection; 5. Simple and easy to learn; 6. Built-in a large number of libraries, especially the network library is very powerful; 7. Built-in powerful tools; 8. Cross-platform compilation; 9. Embedded C support , which can take advantage of the rich existing C library.

What are the benefits of go language

The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.

What is Go language?

Go is a procedural programming language that can be used for fast machine code compilation. It is a statically typed compiled language. It provides a concurrency mechanism that makes it easy to develop multi-core and networked machine-level programs. It is a fast, dynamically typed and interpreted language; it provides support for interfaces and type embedding.

The Go language was developed in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson of Google, but launched as an open source programming language in 2009.

What are the benefits of go language

  • It can be directly compiled into machine code and does not depend on other libraries. The version of glibc There are certain requirements, and deployment is done by just throwing a file up.

  • A statically typed language, but it has the feeling of a dynamic language. A statically typed language can detect most of the hidden problems during compilation. The feeling of a dynamic language is that it has many packages. It can be used and is very efficient to write.

  • The language level supports concurrency. This is the biggest feature of Go. It is born to support concurrency. I once said that there is a difference between natural genes and plastic surgery. We are all equally beautiful. But do you prefer plastic surgery or natural genetic beauty? Go supports concurrency in its genes. It can make full use of multiple cores and make it easy to use concurrency.

  • Built-in runtime supports garbage collection. This is one of the characteristics of dynamic languages. Although GC is not perfect at present, it is enough to cope with most situations we can encounter. , especially the GC after Go1.1.

  • It is simple and easy to learn. The authors of Go language all have C genes, so Go naturally has C genes. Then Go keywords are 25, but the expression ability is very powerful, almost Supports most of the features you've seen in other languages: inheritance, overloading, objects, etc.

  • Rich standard library, Go currently has a large number of built-in libraries, especially the network library is very powerful, and this is my favorite part.

  • Built-in powerful tools. There are many tool chains built into the Go language. The best one should be the gofmt tool, which automatically formats the code and makes team review so simple. Code The format is exactly the same, so it’s difficult to think of something different.

  • Cross-platform compilation. If the Go code you write does not contain cgo, then you can compile Linux applications on the window system. How to do it? Go references the code of plan9, which is information that does not depend on the system.

  • Embedded C support. As mentioned earlier, the author is the author of C, so Go can also directly include C code and make use of the existing rich C library.

What is Go suitable for?

  • Server programming, if you used C Or those things that C does, it is very suitable to use Go to do it, such as log processing, data packaging, virtual machine processing, file system, etc.

  • Distributed systems, database agents, etc.

  • Network programming, this area is currently the most widely used, including Web applications, API applications, downloads Application,

  • in-memory database, groupcache developed by Google some time ago, and part of couchbase constitute the

  • cloud platform. Currently, many foreign cloud platforms are in It is developed using Go and is partly built by CloudFoundy. The former technical director of VMare came up with the apcera cloud platform himself.

Go successful project

  • nsq: bitly open source message queue system, performance Very high, currently they process billions of messages every day

  • docker: a virtual packaging tool based on lxc, which can realize the establishment of PAAS platform.

  • packer: Used to generate image files for different platforms, such as VM, vbox, AWS, etc. The author is the 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, which has exactly the same functions as SAE

  • groupcache: A caching system for Google download system written by the author of memcahe

  • god: A caching system similar to redis, but supports distribution and scalability

  • gor: Network traffic packet capture and replay tool

The following are some companies, just a small part:

  • Apcera

  • Stathat

  • ##Juju at Canonical/Ubuntu, presentation

  • Beachfront.iO at Beachfront Media

  • CloudFlare

  • Soundcloud

  • Mozilla

  • Disqus

  • Bit.ly

  • Heroku

  • google

  • ##youtube
  • 【Tutorial recommendation:

go language

The above is the detailed content of What are the benefits of go language. 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