$ go test -v
[mysql] 2018/06/21 15:13:14 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:14 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
[mysql] 2018/06/21 15:13:15 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:15 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
[mysql] 2018/06/21 15:13:16 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:16 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
[mysql] 2018/06/21 15:13:17 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:17 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
=== RUN TestUserWorkFlow
=== RUN TestUserWorkFlow/Add
[mysql] 2018/06/21 15:13:18 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:18 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
=== RUN TestUserWorkFlow/Get
[mysql] 2018/06/21 15:13:19 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:19 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
2018/06/21 15:13:19 Error 1045: Access denied for user 'root'@'localhost' (using password: YES)
=== RUN TestUserWorkFlow/Del
[mysql] 2018/06/21 15:13:20 auth.go:293: unknown auth plugin:
[mysql] 2018/06/21 15:13:20 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported
2018/06/21 15:13:20 Delete user error: Error 1045: Access denied for user 'root'@'localhost' (using password: YES)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x59da81]
goroutine 72 [running]:
testing.tRunner.func1(0xc0421222d0)
F:/Go/src/testing/testing.go:742 +0x2a4
panic(0x62cc00, 0x794e80)
F:/Go/src/runtime/panic.go:505 +0x237
database/sql.(*Stmt).ExecContext(0x0, 0x69d1c0, 0xc04205a0e8, 0xc04203bf28, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
F:/Go/src/database/sql/sql.go:2224 +0x51
database/sql.(*Stmt).Exec(0x0, 0xc04203bf28, 0x2, 0x2, 0x1, 0xc0420cc260, 0xf, 0x77dc3f)
F:/Go/src/database/sql/sql.go:2253 +0x6c
video_server/api/dbops.DeleteUser(0x67053f, 0x7, 0x66fbad, 0x3, 0x489d6d, 0x5b2b500f)
F:/GoProjects/src/video_server/api/dbops/api.go:35 +0x194
video_server/api/dbops.testDeleteUser(0xc0421222d0)
F:/GoProjects/src/video_server/api/dbops/api_test.go:44 +0x56
testing.tRunner(0xc0421222d0, 0x680848)
F:/Go/src/testing/testing.go:777 +0xd7
created by testing.(*T).Run
F:/Go/src/testing/testing.go:824 +0x2e7
exit status 2
FAIL video_server/api/dbops 7.672s
mysql连接时报错,不过我试过用命令行连接mysql是可以的,也能运行select语句,不知道为什么用go test跑的时候出了这个问题~~?