英文:
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中,点击环境下拉菜单右侧的灰色框“编辑当前环境”。
取消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.
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论