dstobkpm908182 2016-11-21 07:58
浏览 1748


Setting the GOPATH variable global as an enviroment variable works fine with Visual Studio Code.

But setting a project specific variable globally doesn't seem very nice to me. Consider you have multiple Go projects, you would have to change this variable each time you, compile, debug, ... etc. a project.

Is there a possibility to set the GOPATH variable as a project variable in Visual Studio Code? Ether in settings.json or launch.json?

  • 写回答

4条回答 默认 最新

  • dqknycyt92288 2016-11-21 09:03

    Go 1.5 added the vendor directory that allows a per-project dependency management.

    If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import "p" is interpreted as import "d/vendor/p" if that path names a directory containing at least one file with a name ending in “.go”.


    This feature has been enabled by default with Go 1.6:

    Go 1.5 introduced experimental support for a “vendor” directory that was enabled by an environment variable. In Go 1.6, the feature is now enabled by default.


    Even with the 1.6 version, depending on the tools you use, you might need to set the GO15VENDOREXPERIMENT environment variable to 1 (export GO15VENDOREXPERIMENT=1 on unix-based OS)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 全志v3s耳机音频输出口怎么外接功放
  • ¥15 华为ensp使用基本ACL限制公司网络访问
  • ¥15 帮我做下照片上的PLC题
  • ¥15 labview2022 使用modbus报缺少依赖?
  • ¥15 谷歌地图是不是不开通结算功能,api会使用不了哦
  • ¥15 unity腾讯云对象存储机型适配
  • ¥15 求全国交通咨询模拟代码,要求如下,可以完全在dev c++运行
  • ¥15 根据要求修改程序编码
  • ¥15 用 Python 做一个用 Excel 表导入的答题系统
  • ¥15 使用微信开发者工具实现一个“婚博会”小程序