doucan8276 2012-09-12 20:58
浏览 34


I am starting to learn go programing language. I have installed zeus, and eclipse/goclipse. (I like text editor, however i did not find any instructions to plug in with go and compile it). Now, on eclipse I ran a basic hello world and I am getting this:
"Executable source files must be in the 'cmd' folder"

  1. GOROOT set on c:\Go\
  2. GOOS set on windows,
  3. GOARCH set on 386 (I forgot my system, I have windows 32bit)
  4. Go tool path (go) set on auto "c:\go\bin\go.exe"
  5. Go formatter path set on auto
  6. (gofmt)auto "c:\go\bin\gofmt.exe"
  7. and Go documentor path (godoc) set on auto "c:\go\bin\godoc.exe"
  8. finally the GOPATH is empty.

I was following instructions on here and here

Now, on the second link says cmd on the explorer window, there is no "cmd" there is bin, pkg, and src. If you can see why i have the error code, i appreciated a million and thank you veeery much in advance. If anyone can help me set up either vim, or text editor to use with go i can go that route as well. Also, i forgot one more thing, like Socrates says, i know nothing hehe so if you could tell me step at a time to fix as i am proud to be noob. Thanks for reading and sorry about the long text because i wanted to give as much detail as possible. Mar, Thanks, again.

  • 写回答

1条回答 默认 最新

  • dongqun1656 2012-09-12 22:30

    I am not sure what the project state of Goclipse really is, since I don't use it, but I would suggest first and foremost trying the basics of compiling from the command prompt. This will ensure you actually have it working. The instructions given for Goclipse seem old as cmd is not required anymore. That may just be something internal for the project structure in Eclipse+Goclipse.

    Disclaimer: I work in OSX/Linux. This advise for windows is off the top of my head

    If you have already set your system environment variables to the paths you mentioned, then from the command prompt, you should successfully be able to run the go command.

    If you cd in the location of your hello.go test file, you should then be able to run:
    go build hello.go, and have a resulting hello executable in the same location. That is the first step to building a single file.

    GOPATH allows you to set a location for which Go should search to find packages. This location should have underneath it a src directory, and a pkg directory. Your project go will live under src, and pkg is where packages get installed. Having a bin is optional since you can direct the executables to whatever location you want with GOBIN or the -o flag of running go build -o /path/to/bin/hello hello.go

    A generic GOPATH structure might look like this:


    You would then be able to set GOPATH=/path/to/projects and could build from any location via:
    go build -o /path/to/bin/hello hello

    Another alternative to Eclipse is using SublimeText2, which I have found to be excellent, and it is cross-platform just like Eclipse. It also has a package manager to install plugins, and there is a great Go plugin called GoSublime

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀