duanrenchuo9244 2018-12-26 21:50
浏览 671

如何在Visual Studio Code VS上同时修改多个go / golang项目?

I'm working in multiple go/golang project at same time all of them versioned on github. I'm using Visual Studio Code as IDE. For this, I've clone the projects on the same folder and I've opened it on Visual Studio Code. I have to do a modification, for example, in the project A that depends of the project B (both from the same organization), however this modification implies to modify project B too. Then from any go source file on project A I access to code on B but Visual Studio Code shows the code on A stored in go folder from home folder (i.e. /go/pkg/mod/github.com/organization/goproject/core/...). Is there any form to refer to the source code that I've cloned instead of the source code in go folder?

  • 写回答

1条回答 默认 最新

  • dongxianghui3709 2018-12-26 22:38
    关注

    Clone your repositories TO the correct go/src/github.com/... path in your $GOPATH and change your imports to such. Point whatever VCS software you are using to these folders and maintain the repos inside your $GOPATH where they are supposed to be. Then there isn't two copies being maintained, just one. Your IDE will know exactly where to go because it's all in one place.

    This is the way $GOPATH is supposed to work. In Go, you don't keep your project folder outside of the $GOPATH, you put it where it's supposed to go inside it. It's a different sort of project foldering system, but Go was designed this way, so it's best to just follow the paradigm even though it's a little confusing at first.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog