我在 go 中制作了简单的应用程序,并尝试使用 GoLand 的 GUI 工具运行测试。
在 test func 附近的 myfile_test.go 文件中,我按下应该开始测试的绿色按钮。但我收到错误消息:“编译失败”和控制台中的消息:
# command-line-arguments [command-line-arguments.test]
./myfile_test.go:21:11: undefined: MyStruct
./myfile_test.go:22:12: undefined: MyFuncName
./myfile_test.go:33:12: undefined: AnotherStruct
Compilation finished with exit code 2
其他变体(使用覆盖率/CPU 配置文件运行测试)也不起作用。GoLand 2020.1 EAP。在旧版本的 GoLand 中也出现了同样的问题。
但从控制台测试正常启动:
go test -v
=== RUN TestMyStruct_MyMethod
--- PASS: TestMyStruct_MyMethod (0.00s)
PASS
ok _/home/username/projects/my_project_name 0.002s
SMILET
哆啦的时光机
翻过高山走不出你
相关分类