The Way to Go: A Thorough Introduction to the Go Programming Language
Rate it:
7%
Flag icon
go doc package/subpackage        to get the documentation for subpackage in package, ex: go doc container/list
7%
Flag icon
go install (formerly goinstall) is the go-package install tool; much like rubygems for the Ruby language. It is meant for installing go packages outside of the standard
7%
Flag icon
2 Go functions Random() and Seed(), which call the equivalent C functions C.random() and C.srandom(): Listing 3.2—c1.go: package rand
17%
Flag icon
} In fact even the simple Print-functions of fmt (see § 4.4.3) also return 2 values:    count, err := fmt.Println(x) // number of bytes printed, nil or 0, error When printing to the console these are not checked, but when printing to files, network connections, etc. the error value should always be checked. (see also Exercise 6.1b)
20%
Flag icon
When a function is invoked copies of the arguments are made and these are then passed to the called function.
20%
Flag icon
A function call can have another function call as its argument, provided that this function has the same number and types of arguments in the correct order that the first function needs, e.g.: Suppose f1 needs 3 arguments f1(a, b, c int), and f2 returns 3 arguments: f2(a, b int) (int, int, int), then this can be a call to f1: f1(f2(a, b))
20%
Flag icon
Reference types like slices (ch 7), maps (ch 8), interfaces (ch 10) and channels (ch 13) are pass by reference by default (even though the pointer is not directly visible in the code).
20%
Flag icon
Named variables used as result parameters are automatically initialized to their zero-value, and once they receive their value, a simple (empty) return statement is sufficient;
21%
Flag icon
If the last parameter of a function is followed by …type, this indicates that the function can deal with a variable number of parameters of that type, possibly also 0: a so called variadic function: func myFunc(a, b, arg …int) {} The function receives in effect a slice of the type (see chapter 7), which can be looped through with the for _, v := range construct
21%
Flag icon
If in a variadic parameter the type is not specified, it defaults to the empty interface { } which can stand for any other type