[英]golang test error: cannot find package “github.com/stretchr/testify/assert” in any of:
My import looks like this below: 我的导入如下所示:
import (
"testing"
"github.com/stretchr/testify/assert"
)
when I try try running 'go test' I get the error message: 当我尝试运行“ go test”时,出现错误消息:
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]
So it appears the last line is the issue, where it says in .../lib/briteverify it cannot find github.com/stretchr/testify/assert. 因此,似乎最后一行是问题所在,它在... / lib / briteverify中表示找不到github.com/stretchr/testify/assert。 However, I have this as an import so I don't know why it would throw this error.
但是,我将此作为导入文件,所以不知道为什么会引发此错误。 Any thoughts?
有什么想法吗?
Moving the answer here for others in the future. 将来将答案移给其他人。
You need to both import the package and run go get github.com/package/path
to install the package. 您需要同时导入软件包并运行
go get github.com/package/path
来安装软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.