-
Parameters are local variables whose value or arguments are supplied by the caller
-
An object is simply a value or variable that has methods
-
调用方法时,编译器会自动为 receiver 做恰当的值-指针类型的隐式转换,所以可以怎么写简洁怎么来(receiver argument 和 receiver parameter 不一致,分别为
*T
和T
中的任意一个) -
Like maps (
make
, literal) and slices(make
, literal), channels (make
) must be created before use- pointers (
new(T)
returns a*T
; using&
) - Functions are also reference types
- pointers (
-
printf
package fmt func formatOneValue(x interface{}) string { if err, ok := x.(error); ok { return err.Error() } if str, ok := x.(Stringer); ok { return str.String() } // ...all other types... }
-
Dereference: loads the value
- https://golang.org/doc/effective_go.html
- https://golang.org/doc/code.html
- Review (32)
- basic-structure
- assignments
- declarations-initializations
- pointers
- control-flow
- visibility-scope-lifetime
- strings_Unicode_UTF-8_byte-slice
- packages
- integers
- floating-point
- booleans
- complex-numbers
- operators
- constants
- web
- verb-adv
- io
- cmd
- templates
- idiomatic
- go-toolchain
- array
- slice
- maps
- structs
- JSON
- functions
- methods
- interfaces
- goroutine-channel
- concurrency-shared_variables
- testing
Continues at p348