将VSCode的终端GOPATH设置为与go.gopath匹配。

huangapple go评论170阅读模式
英文:

vscode set terminal gopath to match go.gopath

问题

我有一个使用vscode维护的Go项目。

我已经使用vscode中的go.gopath设置为项目设置了GOPATH,在大部分情况下这似乎都工作正常。

然而,当我打开集成终端并输入echo $GOPATH时,显示的值是来自.bashrc而不是go.gopath的值。

我希望集成终端能够遵守由vscode定义的GOPATH,这样当我在终端中运行命令时,一切都能正常运行。

我尝试过在terminal.integrated.shell.osxterminal.integrated.shell.osx中设置值,但似乎没有达到我想要的效果。

我希望在打开vscode时,集成终端能够正确理解GOPATH,并且不必每次打开终端实例时手动设置它。

我找到了一些看起来应该能够解决问题的资源,例如https://github.com/Microsoft/vscode/issues/14973和其他许多资源,但似乎没有一个直接的解决方法。

英文:

I have a Go project that I'm maintaining with vscode.

I have set the GOPATH for the project using the go.gopath setting in vscode, and this seems to work just fine for the most part.

However, when I open the integrated terminal, and type echo $GOPATH, the value shown is the value from .bashrc not the value from go.gopath.

I need the integrated terminal to respect the GOPATH that's defined by vscode so when I run commands in the terminal, everything runs properly.

I've tried setting values in terminal.integrated.shell.osx and terminal.integrated.shell.osx, but nothing seems to do what I want.

I want the intergrated terminal to understand the proper GOPATH when vscode is opened, and not have to manually set this each time I open an instance of the terminal.

I've found resources that seem like the should work, such as https://github.com/Microsoft/vscode/issues/14973 and many others, but nothing seems straight forward.

答案1

得分: 0

VSCode使用go.gopath,我用它来进行诸如go vet和go import之类的工具...您将需要在集成终端中每次使用时导出GOPATH,或在bashrc中设置它...集成终端只是系统实际终端的“克隆”。如果您阅读您提供的线程,您会注意到您想要的是一个功能请求,而不是当前的功能。

英文:

VSCode uses go.gopath i used for tools like go vet and go import... You will have to export the GOPATH on the integrate terminal with each use or set it in the bashrc... the integrate terminal is just a "clone" of the systems actual terminal. If you read the thread you provided you'll notice that what you want is a feature requests and not a current feature

huangapple
  • 本文由 发表于 2017年7月15日 08:16:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/45113209.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定