25 个关键字
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
声明 (4)
var 变量
const 常量
type 类型
func 函数
并发相关 (3)
go 并发
chan 信道
select 分支
类型 (3)
interface 接口
map 映射
struct 结构体
流程控制 (3 + 4 + 6)
defer 延迟执行
goto 跳转
return 返回
循环 (4)
for
continue
break
range 用于读取 slice、map、channel 数据
分支 (6)
if
else
switch
case
default
fallthrough
包 (2)
package
import
39 个预定义标识符
Types:
any bool byte comparable
complex64 complex128 error float32 float64
int int8 int16 int32 int64 rune string
uint uint8 uint16 uint32 uint64 uintptr
Constants:
true false iota
Zero value:
nil
Functions:
append cap close complex copy delete imag len
make new panic print println real recover
值 (4)
true
false
iota
nil
类型 (20 + 2)
int (10)
int
int8
int16
int32
int64
uint
uint8
uint16
uint32
uint64
complex (2)
complex64
complex128
float (2)
float32
float64
字符与字符串 (3)
byte => uint8
rune => int32
string
泛型相关 (2) Go1.18+
any
comparable
其他 (3)
bool
uintptr 指针
error 一个内置的 interface
Builtin 函数 (15)
append
delete
-
close
-
cap
-
len
-
copy
-
make
-
new
-
panic
-
recover
-
print
-
println
-
real
imag
complex