go总结-golang
2020-09-23 10:00:34 0 举报
AI智能生成
go总结,golang总结,不断更新。
作者其他创作
大纲/内容
flow
if
if{ } else [if]{ }
for
for...range
continue|break[LABEL]
switch
case
default
select
case
default
goto LABEL
function
func
Closure
method
ptr receiver
value receiver
OOP
abstraction
interface
struct
encapsulation
struct
package
access control
inheritance
struct
polymorphism
interface
custom type
test
unit test
Test* func
*_test.go
performance test
benchmark test
Example test
unsafe
unsafe.Offset
unsafe.Pointer
uintptr
data type
concrete type
value type
single-value
number
int
float
string
bool
multi-value
struct
array
[...]T
[len]T
complex
reference type
ptr
map
chan
slice
[]T
[]T{}
array[low:high]
array[low:high:max]
abstract type
interface{}
dynamic type[interface]
x.(T)
dynamic value[struct]
custom type
type NewType underline-type
1. act as underline-type
but not the same type
but not the same type
2. add more actions
goroutine
GPM
m:n mapping
SYNC
Mutex
RWMutex
Once
WaitGroup
Pool
Map
Cond
chan
sync chan
buffer chan
Context
WithCancel
WithValue
WithDeadline
WithTimeout
GC
marked by three colors
STW
reflect
reflect.TypeOf
Type
Kind
reflect.ValueOf
IsValid( )
IsNil( )
defer[chan]
1. associated with goroutine
2. FILO
3. recover( ) must be called directly in defer func
to catch panic, in order to prevent catching errors
thrown by others accidentally
to catch panic, in order to prevent catching errors
thrown by others accidentally
收藏
0 条评论
下一页