摘要: package main import ( "encoding/json" "fmt" ) //Student 测试 type Student struct { ID int `json:"id"` //首字母大写,外部json包才能调用,可使用`json`来表示成小写来调用 Gender stri 阅读全文
posted @ 2020-07-12 21:56 kylingx 阅读(135) 评论(0) 推荐(0) 编辑
摘要: //方法:函数指定接收者之后就是方法,只有某个具体的类型才能调用 package main import "fmt" type people struct { name string gender string } //go中,约定使用类型首字母小写 func (p people) dream() 阅读全文
posted @ 2020-07-12 21:54 kylingx 阅读(132) 评论(0) 推荐(0) 编辑
摘要: #参考链接 https://www.cnblogs.com/binghe001/p/13285890.html https://github.com/sunshinelyz/ABTestingGateway 阅读全文
posted @ 2020-07-12 00:18 kylingx 阅读(192) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" ) func main() { a := 1 b := 2 defer func() { err := recover() //recover只能放在defer之后使用 fmt.Println(err) }() //匿名函数 swap(a, b 阅读全文
posted @ 2020-07-12 00:15 kylingx 阅读(85) 评论(0) 推荐(0) 编辑