美文网首页
error obtaining VCS status: main

error obtaining VCS status: main

作者: 简单点的笨演员 | 来源:发表于2022-09-02 16:22 被阅读0次

    一个项目使用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.
    

    解决办法:

    1. 命令build加入-buildvcs=false参数,比如:go build -buildvcs=false ./account
    2. 如果报错是在vscocde中,添加vscode配置:
    {
        "go.buildFlags": [
            "-buildvcs=false"
        ]
    }
    

    相关文章

      网友评论

          本文标题:error obtaining VCS status: main

          本文链接:https://www.haomeiwen.com/subject/goiunrtx.html