golang test error: cannot find package "github.com/stretchr/testify/assert" in any of:
golang test error: cannot find package "github.com/stretchr/testify/assert" in any of:
我的导入如下所示:
import (
"testing"
"github.com/stretchr/testify/assert"
)
当我尝试 运行 '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]
所以最后一行似乎是问题所在,它在.../lib/briteverify 中说找不到 github.com/stretchr/testify/assert。但是,我将其作为导入,所以我不知道为什么会抛出此错误。有什么想法吗?
将答案移至此处以供将来其他人使用。
您需要导入包和 运行 go get github.com/package/path
来安装包。
我的导入如下所示:
import (
"testing"
"github.com/stretchr/testify/assert"
)
当我尝试 运行 '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]
所以最后一行似乎是问题所在,它在.../lib/briteverify 中说找不到 github.com/stretchr/testify/assert。但是,我将其作为导入,所以我不知道为什么会抛出此错误。有什么想法吗?
将答案移至此处以供将来其他人使用。
您需要导入包和 运行 go get github.com/package/path
来安装包。