Go语言中占位符的使用

原文地址: https://studygolang.com/articles/21039 定义示例类型和变量 1 2 3 4 type Human struct { Name string } var people = Human{Name:"zhangsan"} 1. 普通占位符 占位符说明举例输出%v相应值的默认格式。Printf(“%v”, people){zhangsan}%+v打印结构体时,会添加字段名Printf(“%+v”, people){Name:zhangsan}%#v相应值的Go语法表示Printf(“#v”, people)main.Human{Name:”
阅读更多

go test报错 wrong signature for TestAdd, must be: func TestAdd(t *testing.T)

参考: https://www.cnblogs.com/mingbai/p/gotesterr.html 背景 学习 Go 过程中,在终端输入 go test 显示报错: 1 $ wrong signature for TestAdd, must be: func TestAdd(t *testing.T) 后经搜索该报错查明示由于 func TestAdd(t testing.T) 参数未带 *,需要改为 func TestAdd(t *testing.T) 问题复现 报错代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
阅读更多