一个项目使用git来管理代码版本,项目里面有使用单独git仓库的自模块,在项目根目录来build,会出现下面的错误:
D:\mycode\shop>go build ./account
error obtaining VCS status: main package is in repository "D:\\mycode\\shop\\account" but current directory is in repository "D:\\mycode\\shop"
Use -buildvcs=false to disable VCS stamping.
解决办法:
- 命令build加入
-buildvcs=false
参数,比如:go build -buildvcs=false ./account
- 如果报错是在vscocde中,添加vscode配置:
{
"go.buildFlags": [
"-buildvcs=false"
]
}
网友评论