英文:
Visual studio code and vagrant integration
问题
我正在使用MacOS和vagrant进行Go开发。我不想在我的主机上安装任何开发软件包,如Go、npm等。所有的开发软件都安装在vagrant上。
但是,vscode-go插件存在一个问题,因为它需要一些Go软件包,如go vet、goimport等,这些软件包安装在远程主机(vagrant)上。
那么,我该如何告诉vscode在远程主机上运行这些命令呢?
英文:
I am using MacOS and vagrant for Go development. I don't want install any development packages like Go, npm etc. on my host machine (MacOS). All of dev softwares installed on vagrant.
But there is a problem with vscode-go plugin, Because it requires few go packages like go vet, goimport etc. those packages installed on remote host (vagrat)
So how can I say to vscode that run these commands on remote host?
答案1
得分: 1
在vagrant中的GOPATH环境变量上创建一个nfs共享。在你的Mac上也定义一个GOPATH环境变量。这样,vscode就可以在你的vagrant上安装工具。
虽然不确定这是否涵盖了Mac与Linux二进制文件的问题。
另一种方法可能是创建bash别名/函数,通过ssh调用命令。
我写了一篇关于如何在Windows上设置vscode的博客文章。我真的建议你本地安装工具。Go工具集小巧、超快,并且不会给你的系统增加很多臃肿的东西。例如,PHP会添加很多垃圾等。
https://marcofranssen.nl/start-on-your-first-golang-project/
这可能会为你澄清一些问题。
英文:
Make a nfs share on the GOPATH environment variable in vagrant. On your Mac define also a GOPATH env variable. That way vscode can install the tools on your vagrant.
Although not sure this covers Mac vs Linux binaries.
Another approach might be too create bash aliases/functions which invoke the command over ssh.
I wrote a blog post on how to set up vscode on windows. I would really recommend to install tools natively. Go tooling is small, super fast and doesn't add lot of bloat to your system. E.g. PHP ads lots of crap etc.
https://marcofranssen.nl/start-on-your-first-golang-project/
Might clarify some stuff for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论