摘要:
type user struct{ name string } m := map[int]user{ 1: {"user1"}, } 1、从map中取回的是一个value临时复制品,对其成员修改是没有任何意义的 2、当 map 因扩张而重新哈希时,各键值项存储位置都会发生改变。 因此,map 被设计 阅读全文
摘要:
在go项目中读取配置文件时,如果使用的是相对路径,在执行run test时也会在test文件所在的目录下去读取配置文件,如果文件没在此目录下会报错:“open env1.json: The system cannot find the file specified."。 os.Getwd()得到的是 阅读全文