Go,Fix missing environment paths

from: https://github.com/go-lang-plugin-org/go-lang-idea-plugin/blob/master/Missing%20ENV.md


Fix missing environment paths

Sometimes IDEA won't properly detect the environment paths properly. This can happen because of many reasons, especially on Mac OS X and Linux, Windows is not reported to have similar issues.

Usually, the simplest way to fix this is to launch IDEA from the command line. If that doesn't work then read on:

- Linux

You need to set GOROOT and GOPATH in /etc/environment to match the current values from your .profile.bashrc or .zshrcAfter that, you need to restart your system for the changes to take effect.

If you are using Gnome and these variables are stored in .profile, you can change the .desktop file that launches IDEA and edit the Exect line to:

Exec=sh -c "/usr/local/idea/bin/idea.sh" %f

changing the path to idea.sh to the appropriate path of course.

- Mac OS X

If you are launching the IDE the normal application launcher and you get the error message about missing paths then you need to add GOPATH and GOROOT in /etc/launchd.conf to match the values from your .bashrc or .zshrc.

Please note that /etc/launchd.conf does not exist by default, so you will need to create it with the following:

setenv GOROOT /usr/local/go
setenv GOPATH /Users/yourname/go

if setenv returns "Command not found" then the launchctrl command can be used:

launchctl setenv GOROOT /usr/local/go
launchctl setenv GOPATH /Users/yourname/go

It's possible to apply these changes without a restart.

You can view more details here.

You can get more details about launchd.conf in its respective launchd.conf(5) Mac OS X Manual Page.

NOTE

Don't forget to keep the values in sync.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值