我的导入如下所示:
1 2 3 4 5 | import ( "testing" "github.com/stretchr/testify/assert" ) |
当我尝试运行" go test"时,出现错误消息:
1 2 3 4 5 | cannot find package"github.com/stretchr/testify/assert" in any of: /Users/[username]/go/src/github.com/[group_name]/[project_name]/vendor/github.com/stretchr/testify/assert (vendor tree) /usr/local/go/src/github.com/stretchr/testify/assert (from $GOROOT) /Users/[username]/go/src/github.com/stretchr/testify/assert (from $GOPATH) FAIL github.com/[group_name]/[project_name]/lib/briteverify [setup failed] |
因此,似乎最后一行是问题所在,它在... / lib / briteverify中说找不到github.com/stretchr/testify/assert。 但是,我将此作为导入文件,所以我不知道为什么会引发此错误。 有什么想法吗?
-
您是否已运行
go get github.comstretchrtestifyassert 来获取断言包? - ahhhhhhh不! 我是golang的新手,除了每周一次这样做,我忘了。 谢谢!
将来将答案移给其他人。
您需要同时导入软件包并运行