LiteIDE与gvm一起使用。构建、运行和格式化无法正常工作。环境问题吗?

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

LiteIDE with gvm. Build, run, and fmt won't work. Environment issues?

问题

我已经在我的Linux Mint(Ubuntu)系统上使用gvm(Go版本管理器)安装了Go(golang)。

我已经开始了一个项目,但是无法在LiteIDE中构建它。

go build -i [/home/username/go/src/projectname]
错误:进程启动失败。

如果我打开终端并cd到项目的位置,然后执行go build,它可以正常工作。我的go env在LiteIDE之外似乎也可以正常工作。

英文:

I've set up go (golang) on my Linux Mint (Ubuntu) box using gvm (Go Version Manager).

I've started a project, but I can't get it to build from within LiteIDE.

go build -i [/home/username/go/src/projectname]
Error: process failed to start.

If I open a terminal and cd to the project's location and do a go build it works just fine. My go env seems to work just fine outside of liteide.

答案1

得分: 2

GOROOT在LiteIDE中设置不正确。

在终端中输入which go以了解gvm安装的go的位置。例如:

/home/username/.gvm/gos/go1.6/bin/go

在LiteIDE中,点击环境下拉菜单右侧的灰色框“编辑当前环境”。

LiteIDE与gvm一起使用。构建、运行和格式化无法正常工作。环境问题吗?

取消system.env文件中的GOROOT行的注释,并输入从which go获得的正确路径。不要包含“/bin/go”。

GOROOT=/home/username/.gvm/gos/go1.6

保存文件。如果保存按钮变灰,可能需要更改LiteIDE的liteenv目录的权限。我将其安装到/opt/liteide/share/liteide/liteenv

当设置正确配置时,您应该在LiteIDE的构建输出窗口中看到以下内容:

Success: process exited with code 0.
/home/username/go/src/bad/bad  [/home/username/go/src/project]
Hello World!
Success: process exited with code 0.

我个人使用的是linux64-local.env文件而不是使用系统环境配置(在下拉菜单中默认选择的)。我的LiteIDE配置文件如下:

# native compiler linux amd64

GOROOT=/home/username/.gvm/gos/go1.6
#GOBIN=
GOARCH=amd64
GOOS=linux
CGO_ENABLED=1

PATH=$GOROOT/bin:$PATH

LITEIDE_GDB=gdb
LITEIDE_MAKE=make
LITEIDE_TERM=/usr/bin/gnome-terminal
LITEIDE_TERMARGS=
LITEIDE_EXEC=/usr/bin/xterm
LITEIDE_EXECOPT=-e

LITEIDE_SHELL=gnome-terminal;lxterminal;kconsole;xfce4-terminal;xterm
英文:

The GOROOT is not set correctly in LiteIDE.

In a terminal enter which go to know where gvm installed go. Example:

/home/username/.gvm/gos/go1.6/bin/go

In LiteIDE, click on the grey box "edit current environment" right of the environment drop down menu.

LiteIDE与gvm一起使用。构建、运行和格式化无法正常工作。环境问题吗?

Uncomment the GOROOT line in the system.env file and enter the correct path that you got from which go. You omit "/bin/go".

GOROOT=/home/username/.gvm/gos/go1.6

Save the file. If saving is greyed out, you might need to change the permission of LiteIDE's liteenv directory. I installed mine to /opt/liteide/share/liteide/liteenv.

When the settings are configured correctly, this is what you should see in LiteIDE's Build Output window:

Success: process exited with code 0.
/home/username/go/src/bad/bad  [/home/username/go/src/project]
Hello World!
Success: process exited with code 0.

Instead of using the system environment config (the default in the drop down menu) I'm personally using the linux64-local.env file. My LiteIDE config file looks like this:

# native compiler linux amd64

GOROOT=/home/username/.gvm/gos/go1.6
#GOBIN=
GOARCH=amd64
GOOS=linux
CGO_ENABLED=1

PATH=$GOROOT/bin:$PATH

LITEIDE_GDB=gdb
LITEIDE_MAKE=make
LITEIDE_TERM=/usr/bin/gnome-terminal
LITEIDE_TERMARGS=
LITEIDE_EXEC=/usr/bin/xterm
LITEIDE_EXECOPT=-e

LITEIDE_SHELL=gnome-terminal;lxterminal;kconsole;xfce4-terminal;xterm

huangapple
  • 本文由 发表于 2015年9月10日 01:54:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/32486252.html
匿名

发表评论

匿名网友

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

确定