govendor error package not a go package or not in gopath

运行$ govendor init时,Error: Package not a go package or not in GOPATH
#解决方案
设置GOPATH
go env -w GOPATH=~/test# 这里设置为 /test是因为我需要在/test/src下面写代码
然后在GOPATH/src目录下写go的编译器会在GOPATH/src目录下写 go的编译器会在GOPATH/src下面寻找对应的模块,src下的每一个目录都可以对应一个模块,目录中的目录也可以是一个模块,如果,我们需要访问一个目录中的目录中的模块
我们需要调用module中的moduleA模块,只需要使用
import "module/moduleA"

本内容由AI助手生成,请问对您是否有帮助
为你推荐