我试图在我的golang代码中导入一个包 . 但它告诉我这个错误:
找不到包“github.com/mattbaird/jsonpatch”中的任何一个:/opt/go/src/github.com/mattbaird/jsonpatch(来自$ GOROOT)/chaincode/input/src/github.com/mattbaird/jsonpatch (来自$ GOPATH)/opt/gopath/src/github.com/mattbaird/jsonpatch“
有人可以帮我解决这个问题吗?
谢谢 .
2 回答
重新检查环境变量(
$GOPATH
,$GOROOT
) .您遇到的问题是,您的代码正在
/opt/go/src/github.com/
,/chaincode/input/src/github.com/
和/opt/gopath/src/github.com/
目录中搜索包github.com/mattbaird/jsonpatch
. 但是您已在C:\Users\xyz\go\src\github.com
目录中安装了该软件包 .确保正确设置了
$GOPATH
环境变量 .然后仔细检查软件包是否已安装,如果不是,则需要安装可以使用的软件包 .
go get github.com/mattbaird/jsonpatch