💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 1.内置类型 **值类型:** ~~~ int(32 or 64), int8, int16, int32, int64 //整型 uint(32 or 64), uint8(byte), uint16, uint32, uint64 //无符号整型 float32, float64 //浮点数 string //字符串 complex64, complex128 //复数 array -- 固定长度的数组 //数组 ~~~ **引用类型:(指针类型)** ~~~ slice //切片 map //映射 chan //channel 管道 ~~~ ## 2.内置函数 不需要导入就可以使用的内置函数。 ~~~ append //添加元素到数组、slice中,返回修改后的数组、slice close //主要用来关闭channel delete //从map中删除key对应的value panic //停止常规的goroutine (panic和recover:用来做错误处理) recover //允许程序定义goroutine的panic动作 real //返回complex的实部 (complex、real imag:用于创建和操作复数) imag //返回complex的虚部 make //用来分配内存,返回Type本身(只能应用于slice, map, channel) new //用来分配内存,主要用来分配值类型,比如int、struct。返回指向Type的指针 cap //capacity是容量的意思,用于返回某个类型的最大容量(只能用于切片和 map) copy //用于复制和连接slice,返回复制的数目 len //来求长度,比如string、array、slice、map、channel ,返回长度 print、println //底层打印函数,在部署环境中建议使用 fmt 包 ~~~ ## 3.内置接口error ~~~ //只要实现了Error()函数,返回值为String的都实现了err接口 type error interface { Error() String } ~~~