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

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

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。