英文:
Can't use packages in GoClipse
问题
我开始学习Go语言。
在第一次尝试使用命令行之后,我安装了Goclipse。
在这个环境中创建一个新的Go项目时,我得到了以下的文件结构:
-bin
-pkg
-windows_amd64
- src
根据这个示例:http://code.google.com/p/goclipse/wiki/GettingStarted,
我首先创建了一个Hello World程序,在这里我没有遇到任何问题。
但是当我在pkg文件夹下创建一个名为clock的新文件夹,并在ampm.go文件中写入代码时,我在第一行遇到了以下错误:
>此行有多个标记
>- mkdir C:\Windows\go-build441906462: error 5 (FormatMessage failed with err=15100)
>- 7行代码已更改
当我尝试在hello.go文件中导入clock包时,我得到了找不到clock包的错误。
英文:
I started learning go.
After my first try outs with the comand line, I installed Goclipse.
When I creating a new Go Project in this Enviroment I get to following
File Structure:
-bin
-pgk
-windows_amd64
- src
Following this Example: http://code.google.com/p/goclipse/wiki/GettingStarted,
I created first a Hello World Program, here I havn't any Problems.
But when I create under the pkg folder an new folder clock and at the
file ampm.go I get the following Error in the first line:
>Multiple markers at this line
>- mkdir C:\Windows\go-build441906462: error 5 (FormatMessage failed with err=15100)
>- 7 changed lines
When I try to Import the clock package in my hello.go File, I get the
error, that he cant find the package clock.
答案1
得分: 3
如果在goclipse中看到错误,你应该尝试从命令行手动编译代码 - 我注意到有时它似乎无法从编译程序的错误中恢复过来。如果你更改了版本,你还可以检查Eclipse中的Go配置,因为它们移动了文件。清理构建并更改文件也可以强制重新构建。
文件夹结构应该像这样:
proj
--bin(用于命令)
----os_architecture
--pkg(用于编译的包)
----os_architecture
--src
----pkg
------mypkgfolder
----cmd
你可以像这样编译一个包或命令:go build src/cmd/*.go
英文:
You should try to manually compile things from the command line if you see errors in goclipse - I've noticed that sometimes it can't seem to recover from an error compiling a part of the program. You might also check the Go config in Eclipse if you've changed versions, since they moved files around. Cleaning the build and changing a file can force it to rebuild too.
The folder structure should be like this:
proj
--bin (for commands)
----os_architecture
--pkg (for compiled packages)
----os_architecture
--src
----pkg
------mypkgfolder
----cmd
You can compile a package or command like: go build src/cmd/*.go
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论