doucan8276 2012-09-12 20:58
浏览 34
已采纳

转到编程语言,请帮助我设置eclipse或vim或文本编辑器[关闭]

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 http://code.google.com/p/goclipse/wiki/InstallationInstructions and here http://code.google.com/p/goclipse/wiki/GettingStarted.

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:

    projects/
      src/
        hello/
          hello.go
      pkg/
    

    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

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!