Golang Introduction to the Go language

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Go-born background:

Go was not a formal Google project, but as a "20%" project appeared, until 2009 to open-source approach to the public, now go team has a stable release cycle, about six months a new version, the latest is 1.8.

The go language's origins can be said to be very luxurious, the first discussion of the go language was initiated by Robert Greysmore, Robert Paik, and Ken Thompson, primarily to address issues arising in C + + and to initiate projects. Ken Thompson, the inventor of C and UNIX, Robert Greysmore participated in the design of Java's Hotspot virtual machine and the JavaScript V8 engine of the Chrome browser, Robo Paik in the famous Bell Lab for many years, participating in the PLAN9 operating system, C Compiler and multi-language compiler design and implementation.
Go language from 2009 open source to now attracted a lot of developers attention, respectively, to get the 2009 and 2016 Tiobe star, if the 2009 that is because of Google's influence, that this time in 2016 is definitely the strength of its own thick thin hair.

Why a new language is needed:

Traditional languages such as C + +, people spend too much time learning how to use the language, rather than how to better express the writer's ideas, while compiling time is too long, for writing-compile-run this chain for a long period. Dynamic languages such as Python, because there are no strongly typed constraints, many problems need to be found at runtime, and this low-level error should be given to the compiler to discover.
There are also the following trends:

    • Labor costs are getting higher
    • The machine is getting cheaper
    • The performance of the machine is getting worse.
    • Balance development efficiency and operational speed
    • This is the background to the birth of go.

The philosophy of Go:

Simplifying the language must be a bigger achievement-Rob Pike

Go Way of thinking:

最小心智负担原则最小特性最少惊异最少犯错机会

The goal of Go is to become the C language of the Internet, on the basis of keeping C simple and clear, and adding some of its own features:

少就是指数级的多最少特性原则:如果一个功能不对解决任何问题有显著价值,那么就不提供显式表达:所写即所得的语言极度简化但完备的OOP功能内聚:例如,强大的组合能力最友善的 C 语言的支持

Go is a language design for the purpose of software engineering:

快速编译严格的依赖管理代码风格的强一致性偏向组合而不是继承

Make a list of some of the more excellent designs I think:

    • Statements such as the IF for switch do not need parentheses, but the braces are retained to facilitate the positioning of the statement block.
    • You can use: = for automatic type deduction. There is no need to write syntax such as list::iterator it = L.begin ().
    • Sets the visibility using alphabetic case sets visibility. Save the members of the front of a heap of public and private, directly look at the name can be identified.
    • Pointer manipulation is preserved, but pointer arithmetic is removed, pointers are more secure, and the programmer is left with the right to use value semantics and referential semantics.
    • Defer keyword. Mom never had to worry about the handle being closed.

The go support for OOP has the following features:

    • Returning to the basics, no inheritance, only combinations
    • Explicitly differentiate between reuse and abstraction, reuse using combinations, abstract use
    • WYSIWYG, explicit memory model, no vtable and stuff like that.
    • Duck type, abstract more convenient

Go's support for concurrency is an important feature, and go has two great artifacts to support concurrency:

    • Goroutine: Lightweight "Threads"
    • Channel: A pipe of type, co-safe, similar to a pipe inside UNIX.

The design of Go in engineering:

Go Engineering is designed to be considerate:

    • No reliance on hell, even glibc.
    • Compile once, copy anywhere, and deploy very conveniently
    • Compare Gitlab and Gogs https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md

Cross-compiling is just an issue with an environment variable:

    • Binary goos=linux go get github.com/icexin/markdown compiled into Linux
    • Compiled into Windows binary goos=windows go get github.com/icexin/markdown
    • Compiled into arm binary goos=linux goarch=arm go get github.com/icexin/markdown
    • If you try cross-compiling C, you will be able to appreciate this convenience.

Some one-click commands:

    • One-click Compile Go Build

Go Build Github.com/icexin/markdown

    • One-click testing Go Test

Go Test Github.com/icexin/markdown

    • One-click Download update dependency and compile go get

Go get Github.com/icexin/markdown

Go documentation support is the most intimate in all languages, for example, you see a project on GitHub called Github.com/go-redis/redis, Front plus godoc.org that is godoc.org/github.com/go-redis/ Redis can automatically generate all the documents.

Go The Star project:

    • Docker, the Hot container technology
    • Kubernetes,goole Borg's Open source implementation
    • ETCD, high-availability Key-value storage similar to zookeeper
    • TIDB, the open source implementation of Google Spanner developed by people in Taiwan

Go language Features

    • Go language is Google in 2009 Open source of a new system programming language, mainly has the following features:
    • Static compilation
    • Garbage collection
    • Concise notation and syntax
    • Flat type System
    • A CSP-based concurrency model.
    • Efficient and simple tool chain.
    • Extensive library of standards

Go Learning materials:

    • Official website golang.org
    • Go online tutorial tour.golang.org
    • Document golang.org/doc/

The above content is from the reboot Education official website, the introduction is very redundant, but to go language from the origin to go the characteristic and the go language can do what to introduce is very clear, to the first knowledge go language schoolmate very helpful.
I've been learning about the go language since the beginning of 16, but I haven't studied it in depth since. But since 17, with the go language in the programming language of the progress of the list, but also set off a new wave of Go language learning, I also think it is time to delve into the language, so as I will have a lot of study time, I will learn a little go language every week, in time, it used in the actual combat. (Good chicken jelly!) )

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.