Golang-type关键字
定义结构体
type Person struct {
name string
age string
}
type Mutex struct {}
type otherMutex Mutex定义接口
type Person interface {
ShowName(s string)
}定义类型
type Myint int
type (m Myint) showValue() {
fmt.Println("show int", m)
}别名定义
定义函数类型
参考
Last updated