#method
- Methods
- Go does not have classes. However, you can define methods on types.
- func (f MyFloat) Abs() float64 {
- Interfaces
- type Abser interface { Abs() float64 }
- One of the most ubiquitous interfaces is Stringer defined by the fmt package.
- Go programs express error state with error values.
- The io package specifies the io.Reader interface, which represents the read end of a stream of data.
- Package image defines the Image interface
# concurrency
- Goroutines - go say("world")
- Channels
- Channels are a typed conduit through which you can send and receive values with the channel operator, <-.
- ch := make(chan int)
- ch <- v // Send v to channel ch.
- v := <-ch // Receive from ch, and assign value to v.
- Buffered Channels - ch := make(chan int, 100)
- Select
- The select statement lets a goroutine wait on multiple communication operations.
- The default case in a select is run if no other case is ready.
- sync.Mutex
- mux sync.Mutex
- c.mux.Lock()
- defer c.mux.Unlock()
A Tour of Go
https://tour.golang.org/list