在eclipse中发布运行 golang Hello World
Issue running golang Hello World in eclipse
好的,所以只是一个免责声明,我怀疑这个问题将与另一个问题重复,但我什至不确定要搜索什么。
我以前从未使用过 Eclipse 或 Golang,我正在尝试让一个基本的 hello world 应用程序正常工作。
我已经安装了goclipse插件,创建了一个新的go包和go命令源文件。从我读到 运行 Eclipse 中的一个项目,您右键单击该包,select 运行 然后设置 运行 配置。当我尝试 select go 包时出现问题,因为 none 出现,如果我将其留空,它会抛出 'Go package not found' 异常。
感谢您提供的任何帮助。
编辑:根据答案的建议,我决定使用基本命令行,但是一位朋友也推荐了 LiteIDE。关于让 Go 在 eclipse 中工作,我会 "assume" tmichels 的回答是正确的。
如果您不使用 GOPATH
environment variable and you don't put your project folder under $GOPATH/src
the compiler won't find it. As I see it goclipse lets you skip the GOPATH
entirely but in this case you have to put your code under the src
directory that you can see in the Project Explorer. See the related section of the goclipe documentation。
虽然我认为你通过使用完整的 IDE 进行开发让你的生活更加艰难。只需使用命令行工具。它还有一个额外的好处,就是您将真正了解正在发生的事情(IDEs 向您隐藏这一点)。
因此,对于构建,您可以使用 go build
或 go install
。后者会将二进制文件复制到您的 $GOPATH/bin
目录。对于 运行 测试,只需调用 go test
或 go test path/to/package
。 go
工具中有一个隐藏的 gem:当您在同一目录中处理多个包时,您可以使用 go test ./...
一次测试所有包。这也适用于其他 go 命令。
好的,所以只是一个免责声明,我怀疑这个问题将与另一个问题重复,但我什至不确定要搜索什么。
我以前从未使用过 Eclipse 或 Golang,我正在尝试让一个基本的 hello world 应用程序正常工作。
我已经安装了goclipse插件,创建了一个新的go包和go命令源文件。从我读到 运行 Eclipse 中的一个项目,您右键单击该包,select 运行 然后设置 运行 配置。当我尝试 select go 包时出现问题,因为 none 出现,如果我将其留空,它会抛出 'Go package not found' 异常。
感谢您提供的任何帮助。
编辑:根据答案的建议,我决定使用基本命令行,但是一位朋友也推荐了 LiteIDE。关于让 Go 在 eclipse 中工作,我会 "assume" tmichels 的回答是正确的。
如果您不使用 GOPATH
environment variable and you don't put your project folder under $GOPATH/src
the compiler won't find it. As I see it goclipse lets you skip the GOPATH
entirely but in this case you have to put your code under the src
directory that you can see in the Project Explorer. See the related section of the goclipe documentation。
虽然我认为你通过使用完整的 IDE 进行开发让你的生活更加艰难。只需使用命令行工具。它还有一个额外的好处,就是您将真正了解正在发生的事情(IDEs 向您隐藏这一点)。
因此,对于构建,您可以使用 go build
或 go install
。后者会将二进制文件复制到您的 $GOPATH/bin
目录。对于 运行 测试,只需调用 go test
或 go test path/to/package
。 go
工具中有一个隐藏的 gem:当您在同一目录中处理多个包时,您可以使用 go test ./...
一次测试所有包。这也适用于其他 go 命令。