摘要:
序列化 package main import ( "encoding/json" "fmt" ) //结构体 type Monster struct { Name string Age int Birthday string Sal float64 Skill string } //结构体 增加t 阅读全文
摘要:
结构体 创建结构体变量和访问结构体字段 package main import "fmt" //创建结构体变量和访问结构体字段 type Person struct { Name string Age int } func main(){ //方式一 var p1 Person p1.Name="牛 阅读全文
摘要:
国内加速 go相关命令使用 在gopath目录执行 go env -w GOPROXY=direct go env -w GOSUMDB=off go env -w GOPROXY=https://goproxy.io,direct go env -w GO111MODULE="on" go env 阅读全文
摘要:
数据类型 字符串 字符串常用系统函数 字符串循环,长度 //计算长度 func s1() { s := "我爱go语言" fmt.Println("字节长度", len(s)) fmt.Println("...") len := 0 //遍历字符串 for i, ch := range s { fm 阅读全文