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
<font color="#f15a23">Closure</font>
method
ptr receiver
value receiver
OOP
abstraction
interface
struct
encapsulation
struct
package
access control
inheritance
struct
polymorphism
interface
custom type
test
unit test
<font color="#00a650">Test</font>* func
*<font color="#00a650">_test.go</font>
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
<font color="#f15a23">array</font>
[...]T
[len]T
complex
reference type
ptr
map
chan
<font color="#f15a23">slice</font>
[]T
[]T{}
<font color="#f15a23">array[low:high]</font>
<font color="#f15a23">array[low:high:max]</font>
abstract type
interface{}
dynamic type[interface]
<font color="#f15a23">x.(T)</font>
dynamic value[struct]
custom type
type <font color="#f384ae">NewType </font>underline-type
1. act as underline-type <br>but not the same type<br>
2. add more actions
goroutine
GPM
<font color="#f15a23">m:n</font> 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 <br>to catch panic, in order to prevent catching errors <br>thrown by others accidentally<br>
收藏
0 条评论
下一页