go
文章平均质量分 52
牧牧牧牧牧
这个作者很懒,什么都没留下…
展开
-
go学习笔记day3
文章目录jsongoroutine设计策略channel无buffer有buffer管道关闭select 和 channel json package main import( "fmt" // "reflect" "encoding/json" ) type User struct{ Id int `json:"id"` Name string `json:"name"` Age int `json:"age"` Family []string `json:"family"` } fun原创 2021-03-05 19:52:56 · 46 阅读 · 0 评论 -
go学习记录day2(2)
文章目录万能类型golang pair反射 万能类型 interface{} func myfunc(arg interface{}){ value,erro := arg.(string) //判断arg是否是string interface{}独有 } //可以传递任意类型的参数 golang pair golang每个变量都是由type-value组成 type又分为static和concrete type Reader interface{ ReadBook() } type W原创 2021-03-03 21:09:11 · 65 阅读 · 1 评论 -
go学习笔记day2(1)
文章目录mapstruct继承多态 map testMap:=make(map[string]string)//定义 delete(testMap,key)//删除 map在作为参数传递给函数时是传递的引用即指针,指向的是同一块内存地址的值 struct type myint int //声明一种类型或结构体 该语句表示将int取别名为myint type mystruct struct{ a string b string } 结构体在做为参数传递时不是传递的指针,而是传递的副原创 2021-03-03 14:15:11 · 75 阅读 · 1 评论 -
go学习记录 day1
文章目录局部变量的声明全局变量声明常量和iota返回值init函数import导入的问题指针defer 局部变量的声明 //1 var a int a = 100 // 2 var b int = 100 // 3 var c = 100 // 4 d := 100 全局变量声明 全局变量声明只能使用1,2,3方法,方法4只能用于局部变量声明 常量和iota 在变量前加const const b int = 10 const( a = iota b c d ) fm原创 2021-03-02 21:18:17 · 52 阅读 · 0 评论