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 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器