LiteIDE在构建后无法运行代码,进程启动失败。

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

LiteIDE won't run code after building, Process failed to start

问题

大约一周前,我成功在我的计算机上安装了golang,并且能够使用它的终端命令。所以我知道go已经在我的计算机上了。

我一直在寻找一个好的集成开发环境(IDE),并找到了https://code.google.com/p/liteide/ LiteIDE,它专门为Go开发而设计。

我读到说如果你已经在计算机上安装了go,那么你可以使用LiteIDE立即开始构建你的代码。我肯定是在某个地方读错了,因为我根本无法构建我的项目。我认为可能是缺少/错误的路径或者设置有误。

这是我在控制台中得到的错误信息:

当前环境更改ID "win64-user"
C:/go/bin/go.exe env [c:\go]
set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set TERM=dumb
set CC=gcc
set GOGCCFLAGS=-g -O2 -m64 -mthreads
set CXX=g++
set CGO_ENABLED=1
命令以代码0退出。
First_Lite_Go_Proj  [C:/go/src/First Litel Go Proj]
错误:进程启动失败。

我检查了C:/go目录,确保所有内容都是正确的。而且我使用的是64位的Windows 7,也进行了双重检查。

有什么想法吗?我的想法是:缺少/错误的路径,由于权限限制无法访问某个目录。

英文:

About a week ago I installed golang successfully on my computer and got it's terminal commands to process. So by that, I know go is on my computer.

I have been looking for a good IDE and found https://code.google.com/p/liteide/ LiteIDE which was made specifically for Go.

I read that if you already had go installed on your computer then you could use LiteIDE to start building your code right away. I must have read something wrong some where because I cannot get my projects to build at all. I think it there may be a missing/incorrect path and or something is just setup incorrectly.

This is the error I get in the console:

Current environment change id "win64-user"
C:/go/bin/go.exe env [c:\go]
set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set TERM=dumb
set CC=gcc
set GOGCCFLAGS=-g -O2 -m64 -mthreads
set CXX=g++
set CGO_ENABLED=1
Command exited with code 0.
First_Lite_Go_Proj  [C:/go/src/First Litel Go Proj]
Error: process failed to start.

I checked the C:/go directory to make everything there is correct and it was. Also I'm using 64bit windows 7 and double checked that as well.

Any ideas? Mine are: Missing/Incorrect Paths, Can't access a certain directory due to restrictions.

答案1

得分: 1

虽然我没有在Windows 7上测试过这个方法,但在Windows 10上,我采取了以下步骤使LiteIDE工作正常:

  1. 将Go安装到C:\Go目录下。
  2. C:\Go\bin添加到PATH环境变量,并确保在命令行中可以使用go命令。
  3. 这是我认为最重要的一步。在环境变量中定义GOPATH。在我的情况下,路径是C:\Users\vivek\Documents\Source\Go。我还确保在GOPATH下创建了三个文件夹:srcpkgbin。此时,go env命令应该正确显示GOPATHGOROOT的值。go getgo buildgo install命令也应该可以正常工作。
  4. 下载并解压LiteIDE到C:\liteide目录。启动LiteIDE,它应该可以直接使用。通过点击View > Manage GOPATH,确保LiteIDE正确识别到GOPATH

希望这对你有所帮助。祝你好运!

英文:

While I have not tested this in Windows 7, on Windows 10, these were the steps that I took to make LiteIDE work

  1. Installed Go to C:\Go
  2. Added C:\Go\bin to PATH and made sure go was working from Command Line
  3. This was the most important step for me. Defined GOPATH in an environment variable. In my case, it was C:\Users\vivek\Documents\Source\Go. I also made sure that there were three folders src, pkg and bin were created in GOPATH. At this point go env was showing me correct values for GOPATH and GOROOT. go get, go build and go install was working as well at this step.
  4. Downloaded and unzipped LiteIDE to C:\liteide. Started LiteIDE and it worked out of the box for me. Make sure that GOPATH is seen correctly by LiteIDE by going to View > Manage GOPATH

Hope this helps. Good luck.

答案2

得分: 1

将您的项目保存在GOROOT路径中并不是一个好主意,默认情况下(使用MSI安装程序安装时),GOROOT路径是C:\Go。始终将其与其他位置分开是一个好习惯,这也有助于避免更新时出现问题。

由于Go项目由组织在目录结构中的包组成,因此遵循一些规则并保持Go项目的工作空间分离和清洁非常重要。

在我看来,最佳实践是在您的用户空间中创建一个工作目录作为所有Go项目的根目录,并坚持使用它。

一种方法是创建一个名为"work"的目录,并将环境变量GOPATH设置为它(例如C:\Users\Peter\Documents\work)。在更改后,请确保重新登录或重新启动计算机。

在某些操作中,Go将自动在您的GOPATH下创建bin、pkg和src目录。

  • src目录包含您创建或下载的Go源文件,
  • pkg目录包含您安装的包对象,
  • bin目录包含您安装的可执行文件。

当您使用go install命令安装二进制可执行文件或包时,将自动创建bin或pkg目录。重要的是要理解,这些文件不是Go安装的一部分。

如果src目录尚不存在,将在您首次执行go get命令时自动创建,或者在LiteIDE中,当您首次创建新的Go1 Command ProjectGo1 Package Project时。请注意对话框上的“Location:”字段,它应该包括您在GOPATH中定义的路径,后面跟着\src(例如C:\Users\Peter\Documents\work\src)。

name field中输入您要为项目使用的路径。如果您计划在Github(或其他仓库)上跟踪项目的开发,通常会在源路径中包含Git仓库的路径(例如github.com/petergloor/hello-go)。

当然,您可以使用任何其他结构来组织您的项目,只要确保它们位于GOPATH的src目录下即可。

有关Go工作区的更多信息,请阅读https://golang.org/doc/code.html#Workspaces。

关于GOROOT环境变量的最后一点说明。如果您将Go安装在C:\Go中,请不要显式设置此变量。只需将C:\Go\bin包含在您的路径中并设置GOPATH即可。只有在Go安装在其他位置时才需要设置GOROOT。

英文:

It's not a good idea to keep your projects in the GOROOT path, which per default (when installed using the MSI installer) is C:\Go. Always keep it separated from there. It also helps to avoid issues with updates.

Since Go projects are made up of packages which are organized in directory structures it is important to follow a few rules and keep the working space for your Go projects separated and clean.

In my opinion its best practice to create ONE working directory as the root for ALL your Go projects somewhere in your user space and stick to it.

One way to do this is to create a directory like "work" and set the environment variable GOPATH to it (e.g. C:\Users\Peter\Documents\work). Make sure to relog or restart your computer after your changes.

Upon certain operations Go will automatically create the directories bin, pkg and src below your GOPATH.

  • src contains your created or downloaded Go source files,
  • pkg contains your installed package objects, and
  • bin contains your installed executable files.

bin or pkg will automatically be created when you use the go install command to install a binary executable or a package. It's important to understand that these are files that are not part of the Go installation.

src, if it does not yet exist, will automatically be created the first time you issue a go get command or in case of LiteIDE, the first time you create a new Go1 Command Project or Go1 Package Project. Watch the "Location:" field on the dialog box, it should include your path defined in GOPATH followed by \src (e.g. C:\Users\Peter\Documents\work\src).

In the name field enter the path you want to use for your project. If you plan to track the development of your project on Github (or other repo) it's common practice to include the path to the Git repo in your source path (e.g. github.com/petergloor/hello-go).

Of course you can use any other structure to organize your projects as long you make sure they fall below the src directory in your GOPATH.

For more information about Go workspaces read https://golang.org/doc/code.html#Workspaces.

A final note about the GOROOT environment variable. Dont explicitly set this if you install Go in C:\Go. It's enough to include C:\Go\bin in your path and to set GOPATH. GOROOT is only needed in case Go is installed at another location.

答案3

得分: 1

我也曾经遇到过这个问题,但在完成安装过程后,我成功了。

步骤1:
运行(Ctrl+R)-> 运行目标,首先请求构建。
构建并运行(Ctrl+F7)-> 构建并运行目标
文件运行(Alt+F6)-> 运行

步骤2:
通过以下网址检查配置:
https://www.goinggo.net/2013/06/installing-go-gocode-gdb-and-liteide.html

英文:

I also had this problem first, but after completing the installation process, I succeeded.

Step 1: <br>
Run (Ctrl+R) -> run target, request build first. <br>
BuildAndRun(Ctrl+F7) -> build and run target <br>
FileRun(Alt+F6) -> go run

step 2: <br>
Check Config via this URL: <br>
https://www.goinggo.net/2013/06/installing-go-gocode-gdb-and-liteide.html

答案4

得分: 0

尝试将GOROOT设置为安装go的目录。这对我起作用了。

英文:

Try setting up the GOROOT to the directory where go was installed. It worked for me.

答案5

得分: 0

你的项目名称中是否包含“Install”关键字?尝试将其移除。

英文:

Do you have 'Install' keyword in your project name? Try remove it.

答案6

得分: 0

你需要正确设置LiteIDE的变量(如果默认情况下没有设置)。请按照以下两个选项进行检查:

  1. 转到设置 → "管理GOPATH"
  2. 选项 → LiteEnv(这里有环境定义文件)。只需双击其中一个文件,然后设置Go环境变量。

LiteIDE在构建后无法运行代码,进程启动失败。

LiteIDE在构建后无法运行代码,进程启动失败。

英文:

You have to setup LiteIDE variables correctly (if there are not by default).
Please, check two options:

  1. Go to Settings → "Manage GOPATH"
  2. Options → LiteEnv (there are
    environment definitions files). Just double click on someone and
    setup Go environment variables.

LiteIDE在构建后无法运行代码,进程启动失败。

LiteIDE在构建后无法运行代码,进程启动失败。

答案7

得分: 0

我不确定这个是如何工作的,但在我的情况下它起作用了。我从YouTube-Chris Hawkes的视频中得到了这个想法。

  1. 打开LiteIDE。
  2. 点击文件---新建。
  3. 选择“Go1命令项目”。
  4. 浏览所需路径。
  5. 选择所需文件夹。
  6. 命名文件夹并点击确定。
  7. 现在,你将能够在IDE中看到一个名为“main.go”的文件。
  8. 使用正确的语法在这个文件中编写你想要运行的任何代码,它将会运行。

唯一的问题是,每当我在同一个文件夹中创建另一个“.go”源代码文件时,都会显示相同的错误。所以,每次你尝试编写新代码时,可能需要编辑这个文件。

LiteIDE在构建后无法运行代码,进程启动失败。

英文:

I'm not sure how this works, but it worked in my case. I got this idea from this video on Youtube-Chris Hawkes

  1. Open LiteIDE.
  2. Click File---New.
  3. Select "Go1 Command Project".
  4. Browse the desired path.
  5. Select the desired folder.
  6. Name the folder and click Ok.
  7. Now, you will be able to see a "main.go" file opened in the IDE.
  8. Write whatever code you want to run in this file with correct syntax, it will run.

The only problem with this is, whenever I create another ".go" source code file in the same folder, the same error is shown. So, you might have to edit this file every time, you try to write new code.

LiteIDE在构建后无法运行代码,进程启动失败。

huangapple
  • 本文由 发表于 2014年4月29日 13:28:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/23356189.html
匿名

发表评论

匿名网友

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

确定