Overview
Stuff regarding Go programming language.
Figure out/Stuff
- proper brace placement to avoid semicolon insertion
- “import path” versus “package name” (factored import statement)
- fmt.Printf() format specifiers
- named return values (explicit or allow to default)
- type “zero values”
- “var p = &Vertex{1,2}”, what is the scope/lifetime?
- how to list all package methods from the command line?
- how multi-platform things like Sqrt() work?
- possible formats of for loop
- neat uses of “defer” statements (stacked)
- deferred call args are evaluated immediately
- modifying named return values
- package “init” functions
- closures
- methods
Course outline
- installation
- /usr/lib/golang package structure (Go 1.13), personal src structure
External links
Official Go home page
Articles on Go
- Why should you learn Go? (Jan, 2017)
- The beauty of Go (Oct, 2017)
- What's the Go language really good for? (Jun, 2017)
- About Go Language -- An Overview (Sep, 2017)
Technical papers on Go
Internal wiki links
Language features
Methods
- Go does not have classes; a method is a function with a special receiver argument (such as “Vertex”).
- Value receiver versus pointer receiver (one or the other, not both)
- Functions with a pointer argument must take a pointer, while methods with pointer receivers take either a value or a pointer as the receiver when they are called.
- Methods with value receivers take either a value or a pointer as the receiver when they are called.