my golang note
Just for me, for saving. -:)
大写第一个字母:public, package name: 小写
:=
uint8 => byte(0-255), int32 => rune
nil: interface, function, pinter, slice, map, chan
const: iota, true, false, nil
func append(s []T, vs ...T) []T
import: dot, alias, init
make: make(T args), slice, map,channel
if, for, switch: define var , switch: fallthrough
interface: func (a type) f => func (a *type) f
(value, type): t, ok := i.(T)
error is a interface, defer: LIFO
func panic(interface {})
func recover() interface {}
channel timeout, select , sync.Once
one-way: send: chan<-, receive: <-chan
没有隐式数值类型强制转换
没有构造或析构函数
没有运算符重载
没有形参默认值
没有继承
没有泛型
没有异常
没有宏
没有函数注解
没有线程局部存储
没有未初始化变量
go run -race main.go
go tool cover
go test -bench=.
go test -cpuprofile=cpu.out
go test -memprifile=men.out
go tool pprof -text cpu.out
go get -v -u github.com/...
GO111MODULE:
go mod init
go mod tidy