摘要: echo在输出一行信息的时候,会自动加上换行符,然而有些时候,我们不想让它这么做,可以添加上-n选线: -n do not output the trailing newline 阅读全文
posted @ 2022-12-08 10:21 cosmoswong 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 观察下面的程序的输出结果 func main() { sn1 := struct { age int name string }{age: 11, name: "qq"} sn2 := struct { age int name string }{age: 11, name: "qq"} if sn 阅读全文
posted @ 2022-12-08 09:47 cosmoswong 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 1、如何显示文件是否发生了修改? 2、添加自定义模板代码 如想要生成这段代码的模板: func (this *UserClass) Build() { this.Handle("GET", "/User", this.GetUser()) } 通配符定义: 使用: 3、设置变量的值 https:// 阅读全文
posted @ 2022-12-08 09:39 cosmoswong 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 下面这段代码输出什么,说明原因。 func main() { slice := []int{0, 1, 2, 3} m := make(map[int]*int) for key, val := range slice { m[key] = &val } for k, v := range m { 阅读全文
posted @ 2022-12-08 09:20 cosmoswong 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 1)iteration variable重用 for range的idiomatic的使用方式是使用short variable declaration(:=)形式在for expression中声明iteration variable,但需要注意的是这些variable在每次循环体中都会被重用,而 阅读全文
posted @ 2022-12-08 09:08 cosmoswong 阅读(28) 评论(0) 推荐(0) 编辑
摘要: write已经close的channel panic close已经close的chanel panic close nil channel panic 阅读全文
posted @ 2022-12-08 08:55 cosmoswong 阅读(29) 评论(0) 推荐(0) 编辑