Go language learning process

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

Contact Go is the 2012, the real start of the system of learning and development system is 2014 years, go language learning is one of their 2014 years of important work, the summary of Go language learning, is also considered one of the end of the year

1. Reasons and motivations for learning go:
1> has previously done 2 years of Unix C development experience, for the C language has a special feeling, go is particularly suitable for my appetite, after the use of love;
The 2>go language team is too dazzling and powerful: the Thompson Turing Prize winner, the co-inventor of Unix and C, the main developer of the Pike PLAN9 operating system, the UTF-8 inventor; Robert Griesemer the hotspot in Java, JS V8 engine developer;
3> domestic preacher's highly recommended: Xu Xiwei brother, brother Xie Mengjun and other strong recommendations and related books came out;

2. Learning Materials:
Books are: Lao Xu's "Go Language Programming", Lao Xie's "Go Web Programming", rain marks of "Go language learning Notes", golang.org above the "effective go", "The Go Programming Language specification", The Go standard library and many open source libraries on GitHub

Of course, no-smell video tutorial is also very suitable for beginners, followed him to the code to knock over the multiplier

3.go Learning Experience:
Go language basic knowledge is very simple, simple to a few days can learn, and can start to develop; but to be proficient, not a certain amount of code and a few years of experience is difficult to achieve, which is to learn any programming language must be experienced, the only thing you can do is: Keep writing code, keep thinking, keep summarizing, Read other people's code constantly, to the master to consult;


4.go learning difficulties, the difficulties encountered in my study, as well as related reference index, these points of knowledge is a bit difficult for new learners, but for the developers who want to master the go skills, I think is very valuable, these points of knowledge is the individual step after walk through the pit to explore:

    • Go map Slice string array interface The underlying data model, where array and slice are the root causes of confusion; see: Russ Cox very classic article

GO Data Structures

Arrays, slices (and strings): The Mechanics of ' append '

    • Go defer panic recover is go-specific, go error is the error, exception is abnormal, not confused, the design on the surface of the code is upset, actually more clear, try catch surface is clear, actually hide too many problems. (Two error handling mechanisms: Exception throw mechanism-error code handling mechanism)

Several scenarios for using defer

    • Go Interface interface Implementation mechanism (can go deep into the source) (Deep to understand: interface assignment, interface transformation, interface assertion and go dynamic); Go is an interface-oriented, combination programming language, for the Go Language interface is the soul is not too far;

See also: Old Xu "Go Language Programming" Chapter 9th section 9.5 interface mechanism

Join: A big foreign guy wrote: How to use interfaces in Go

See also: Interfaces_and_types

See ALSO: Learning Go-interfaces & Reflections

    • Go type System: This is important for mastering a language: Static type (language level is statically typed language), dynamic type (dynamically typed for interface), underly type (underlying type for cast and assignment), go type System is more concise, Clean, is the value type, even if looks like slice,map,channel,func and so on is the reference type, actually also is the value type, but its internal data structure encapsulates the pointer just; unlike Java there are two sets of types: The basic is the value type, the object is the reference type, the middle has the boxing, the unpacking action, A more wonderful string;

See also: the Go programming Language Specification-type

See ALSO: Learning Go-types

    • Go function: Multivalued return, with named return parameter usage; closure; function is a class citizen; The function is also an underlying type, which can be defined as a type by the type XXX func for a function, and the concurrent go takes the H function as the carrier; The object is the data with the behavior And closures are data-attached behavior.

See also foreign Daniel: Function Types in Go (Golang)

Go closures: A discussion on the closure of function programming (Closure) Go Language (Golang)-closures

Go functional Programming: GO-functional programming practice

    • Go parameter pass: function parameter All is pass value: Even if pass a pointer, pass is also a copy of pointer; Closure reference external variable is reference
The so-called reference refers to the use of a pointer, but there is a pointer effect, reference: A as a parameter transfer function inside, the function of internal modification A but change the value of external a

Pointer: *a is passed as a parameter to the inside of the function, the function internally modifies the value of *a, and the value of the external a point changes;

See also: pass-through and citation of the Go language this article analyzes the very rare good articles in place

    • Go error handling mechanism, error and nil relationship, see

Nil value and nil for error type in Go

These two articles abroad are also better, teach you how to customize the error to return more specific errors;

Error Handling in Go, part I

Error Handling in Go, part II


    • Go Nil has also been a stumbling block for go learners

There's an article on the error nil related

Here is a Interface nil article Golang: detailed Interface and nil Chen brother about go of a few articles are very grounded gas, suggestions have looked

    • Go package, Global Const (constant), VAR (variable) load order, and package reference mechanism:
See also: the "Go Language Program", which Lao Xu translated

    • Go reflect: Reflection is a powerful weapon that a novice must dabble in and is a way of metaprogramming that is relatively low performance (flexibility also brings performance issues)

See also: Official version laws-of-reflection

Translated by: The-laws-of-reflection I think this is the best article in translation, which incorporates the author's thoughts and perceptions.

And my abbreviated version, more of a guideline for the API: the Laws of reflection

Reflection Small Test Skill: Refer to this article in Golang with the name of the function Mikespook translation of other articles is also very good

Martini Framework uses the Classic DI library: inject textbook office to implement injection

Inject library code is very obscure, you can refer to Brother Chen's side of the classic article Golang:martini inject source analysis This article is easy to read, written very good

Reflection is closely related to interface, go type System, REFELCT. TYPEOF returns the dynamic type of the interface, the Func (v Value) type () type, which returns the type of Value, reflect. Type is the underlying type expression

    • Go channel and Gorutone use method; concurrent programming mode; implementation principle. If the go language is a crown, the Goroutine and channel are the crown jewel, go is the practitioner and reformists of the CSB concurrent programming theory; go reduces the complexity of concurrent programming by an order of magnitude, since concurrent programming is no longer a patent for some self-proclaimed "tech kinky" The world should be so simple, the language and compiler can do a good job do not let the programmer blind, this is the philosophy of go;

Related references:

See "Go Concurrency Programming" (To be honest, this book did not meet my expectations of the level, writing is the foundation, the language is a bit verbose, digging deep enough, but the pull is not high, so-called pull is not a systematic introduction of concurrent design mode)

See system knowledge behind the Goroutine

Go memory model English Chinese version of the need to turn over the wall, a bit obscure, the Chinese writing is very good, into the translator's own thinking, recommended reading;

Go language concurrency of the United States this article is written very well, the common mode of concurrency written in layman's terms, this "go concurrent programming" a very thick book actually did not have these content, it is disappointing, a bit illusory

Several articles of Daniel at the Google IO Conference (with walls)

Concurrency is not Parallelism there is a translation of the concurrency not parallel

Go Concurrency Patterns

Advanced Go Concurrency Patterns

Go Concurrency patterns:pipelines and cancellation here is a translation: Go concurrency mode: pipeline and explicit cancellation


    • Go scheduler model, go memory management, Gc,go debugging and performance analysis, cross-platform; these are advanced propositions, and when a program encounters performance problems, you may need to understand the implementation mechanisms of go concurrency, find problem points, circumvent or improve, or find alternatives; unless you have a strong curiosity, The general programmer does not read the entire runtime implementation.

See Rain Scars Study Notes

The Go Scheduler here is a translation Go scheduler

Ali Skoo a few articles on the scheduler process is very vivid writing

Go concurrency programming also discusses the go scheduling.

Foreign this ppt is also good, there is an article


5. Framework Learning:

Thanks to the Beego framework, Beego is very easy to get started, modular design, and modules are very complete; Xie adults more enthusiastic, QQ Group is more active, my two small systems are based on beego development; This reading of the small black for the people who want to see the framework of the source is a gospel;

Martini just saw inject that part, 2015 hope to have time to look at Martini and Revel.


6. Look forward to

Looking forward to a cow who can give a special introduction to go how to design a large system of books, go language design patterns and object-oriented design patterns are very different; Lao Xu has a ppt inside the introduction of the connection and the combination of the language, to the size of seven cattle system, should be able to abstract a set of patterns out, someone do? Concurrent related design patterns, there are many articles on the Internet, but it is not very systematic; I hope 2015 of us can stand up and do this, and we stand on the shoulders of giants and move on.


in fact, it's not about learning: I am a large part of the time or side of the development, learn the standard library, while learning, encounter a larger common module to GitHub to find out whether it has been realized, if you think you have rewritten better than the original author, you can pull request. Of course, in the development of the blind spot of their knowledge, it is necessary to have a unit of the spirit of research, to understand it, technology will naturally be improved, personal thin see, cautious reference.

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.