6

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.

OneOfOne
  • 95,033
  • 20
  • 184
  • 185
Andrew
  • 3,393
  • 4
  • 25
  • 43
  • Can you try and set your `GOPATH` somewhere else? Go shouldn't have to look for your source in `GOROOT` (`C:\go`): it should look for them in `GOPATH` (`C:\wherever\go[src|pkg|bin]`) – VonC Apr 29 '14 at 05:41
  • GOPATH is not defined. should be ${HOME}/go or something like that – Not_a_Golfer Apr 29 '14 at 08:38
  • @Not_a_Golfer go path is now set to ... ${HOME}/go ... and the output of liteIDE showed me : `GOPATH=${HOME}\go;C:\Go;C:\Go\src;C:\Go\pkg;C:\Go\bin` and im on windows 7. Still have the same error. – Andrew Apr 29 '14 at 13:32

7 Answers7

1

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.

Vivek
  • 382
  • 4
  • 12
1

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.

Peter Gloor
  • 917
  • 6
  • 19
  • Just realized that this question is two years old. Well, since LiteIDE is still an active project and certainly interesting for beginners it might help someone else. – Peter Gloor Dec 07 '16 at 18:13
1

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

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

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

0

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

0

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

James Wu
  • 21
  • 5
0

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.

enter image description here

enter image description here

0

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.

See for reference

lousycoder
  • 451
  • 6
  • 10