Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing `对包进行测试失败,但单独测试运行正常,包编译正常_Unit Testing_Go - Fatal编程技术网

Unit testing `对包进行测试失败,但单独测试运行正常,包编译正常

Unit testing `对包进行测试失败,但单独测试运行正常,包编译正常,unit-testing,go,Unit Testing,Go,当我对整个软件包执行go test时,测试失败: $ go test github.com/dm03514/go-edu-db/... # github.com/dm03514/go-edu-db/backends go1: internal compiler error: in read_type, at go/gofrontend/import.cc:669 Please submit a full bug report, with preprocessed source if approp

当我对整个软件包执行
go test
时,测试失败:

$ go test github.com/dm03514/go-edu-db/...
# github.com/dm03514/go-edu-db/backends
go1: internal compiler error: in read_type, at go/gofrontend/import.cc:669
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gccgo-4.9/README.Bugs> for instructions.
FAIL    github.com/dm03514/go-edu-db/backends [build failed]
?       github.com/dm03514/go-edu-db/cmd        [no test files]
# github.com/dm03514/go-edu-db/httpd
go1: internal compiler error: in read_type, at go/gofrontend/import.cc:669
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gccgo-4.9/README.Bugs> for instructions.
FAIL    github.com/dm03514/go-edu-db/httpd [build failed]
?       github.com/dm03514/go-edu-db/logging    [no test files]
以前有人碰到过这个吗?我是新来的,为了解决这个问题,我刚刚分别执行了我的每个测试文件

go build的输出什么都不是

$ go build github.com/dm03514/go-edu-db/...
$
go版本是

$ go version
go version xgcc (Ubuntu 4.9-20140406-0ubuntu1) 4.9.0 20140405 (experimental) [trunk revision 209157] linux/amd64

我安装了ubuntu
golang
软件包

$ go version
go version go1.2.1 linux/amd64
现在,我在运行包测试时收到了有意义的错误消息:


$go-test-github.com/dm03514/go-edu-db/。
我安装了ubuntu
golang
软件包

$ go version
go version go1.2.1 linux/amd64
现在,我在运行包测试时收到了有意义的错误消息:


$go test github.com/dm03514/go-edu-db/。

可能是例行泄漏。您可能在测试中修改/更新了一个全局变量,而在第二次测试中没有恢复。 此错误的第二个原因可能是您的测试未在封闭环境中运行。并在试验结束后进行其他试验。
您可以重新构造测试,以便首先运行给出错误的测试,使其成功

可能存在例程泄漏。您可能在测试中修改/更新了一个全局变量,而在第二次测试中没有恢复。 此错误的第二个原因可能是您的测试未在封闭环境中运行。并在试验结束后进行其他试验。
您可以重新构造您的测试,使给出错误的测试首先运行,以使其成功

运行<代码>go build的输出是什么?您使用的go版本是什么?@JimB version是4.9.0运行<代码>go build的输出是什么?您使用的go版本是什么?@JimB version是4.9.0您可以共享测试顺序吗哪个对你有用?这将是一个更好的答案,为读者提供一些信息。我不确定,我只是尝试随机移动测试顺序,并在每次更改后运行
go test
,它突然开始工作。你能分享一下对你有效的测试顺序吗?这将是一个更好的答案,可以为读者提供一些信息。我不确定,我只是尝试随机移动测试顺序,并在每次更改后运行
go test
,它突然开始工作。