【GO】windows下go语言开发环境搭建

1.首先安装go,环境变量自动配置;
2.在D盘新建文件夹,命名为mygo,D:\mygo,配置环境变量GOPATH=D:\mygo,
3.安装govendor:
     s1. 命令行执行 go get -u  github.com/kardianos/govendor
     s2. 进入D:\mygo\src\ github.com \kardianos\govendor,执行 go build, go install, 在D:\mygo\bin路径下将出现govendor.exe文件
     s3. 在D:\mygo创建src文件夹,在src文件下创建myproj,D:\mygo\src\myproj

     s4. 进入D:\mygo\src\myproj,执行govendor init,D:\mygo\src\myproj将出现一个新的vendor文件夹

go build 时,依赖的package查找顺序:

main.go:27:2: cannot find package "mygit.com/business/myproj/backend" in any of:
        D:\mygo\src\myproj\vendor\mygit.com.com\business\myproj\backend (vendor tree)
        D:\mygo\src\vendor\mygit.com.com\business\myproj\backend
        D:\Go\src\mygit.com.com\business\myproj\backend (from $GOROOT)
        D:\mygo\src\mygit.com.com\business\myproj\backend (from $GOPATH)

你可能感兴趣的:(开发语言)