基本类型

  • 整型

    • 有符号整型:int8,int16,int32,int64,int 默认值:0

    • 无符号整型:uint8,uint16,uint32,uint64,uint 默认值:0

    • 特殊整型:rune,byte,uintptr 默认值:0

  • 浮点型

    • 浮点类型:float32,float64 默认值:0.0

    • 复数类型:complex64 complex128 默认值:0+0i

  • 布尔型

    • 布尔型:bool 默认值:false
  • 字符串

    • 字符串:string 默认值:""

复合类型

  • 数组:[size]type 默认值:为数组type的默认值,例如[5]int的默认值为,[0,0,0,0,0]

  • 结构体:type xxx struct{} 默认值:与数组类似,是其所有成员的默认值

引用类型

  • 指针: *Type 默认值:nil

  • 字典:map[Type]Type 默认值:nil

  • 切片:[]Type 默认值:nil

  • 通道:chan 默认值:nil

  • 函数:func 默认值:nil

接口类型

  • 接口:type xx interface{} 默认值:nil