摘要: https://geektutu.com/post/hpg-gotchas-array-slice.html 语言陷阱系列文章链接: Go 语言陷阱 - 数组和切片 (Dec 7, 2020) 源代码/数据集已上传到 Github - high-performance-go 1 第一个陷阱 1.1 阅读全文
posted @ 2021-10-24 21:02 技术颜良 阅读(74) 评论(0) 推荐(0) 编辑
摘要: https://geektutu.com/post/quick-golang.html 一般而言,接口定义了一组方法的集合,接口不能被实例化,一个类型可以实现多个接口。 举一个简单的例子,定义一个接口 Person和对应的方法 getName() 和 getAge(): 12345678910111 阅读全文
posted @ 2021-10-24 11:50 技术颜良 阅读(938) 评论(0) 推荐(0) 编辑
摘要: ackage main import "fmt" func main() { age := (int)(25) //或者使用 age := (interface{})(25) fmt.Printf("type: %T, data: %v ", age, age) } 阅读全文
posted @ 2021-10-24 11:03 技术颜良 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1. 静态类型 所谓的静态类型(即 static type),就是变量声明的时候的类型。 var age int // int 是静态类型 var name string // string 也是静态类型 它是你在编码时,肉眼可见的类型。 2. 动态类型 所谓的 动态类型(即 concrete ty 阅读全文
posted @ 2021-10-24 11:02 技术颜良 阅读(298) 评论(0) 推荐(0) 编辑