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 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line