eclipse - 无法在 GoClipse 中构建 Go 应用程序
问题描述
我有一个简单的 Go 程序,一个从某处教程复制的基本 hello world。我正在使用添加了 GoClipse 功能的 Eclipse。如果我右键单击应用程序所在的文件夹,并将其作为 Go 应用程序运行,它就可以工作。如果我转到命令提示符并键入go run
或者go build
它可以工作,无论是用于主程序的特定文件还是外部目录。
但是,如果我尝试构建项目,则会收到错误消息:
# golang.org/x/tools/cmd/splitdwarf
runtime.main_main·f: function main is undeclared in the main package
我的程序是:
package main
import "fmt"
func main() { fmt.Println("Hello World") }
目录结构为:
$GOPATH/src/foo/bar.go
GOPATH
是C:\goSpace
和GOROOT
是 `C:\Go
解决方案
推荐阅读
- java - PKIX 路径构建失败:导入证书后
- python - 当你用 Cython 编译一个独立的可执行文件时,你可以使用其他 python 模块,如 pandas 和 numpy 吗?
- angular - 使用 Angular HttpClient 从 Rest 请求中获取“真实对象”(字段和方法)
- python - 发送到断开连接的套接字第一次成功
- go - 如何实时收集 Terraform 计划命令输出以显示在前端?
- javascript - 如何在 tinyMCE Javascript 上处理 404 图像 url
- android - 在 TextView Kotlin 中的 OCR 文本提取上搜索和可点击文本
- spring-cloud-config-server - 如何在不使用 spring.cloud.config.server.git.refreshRate 属性的情况下以编程方式从 spring 云配置服务器中的 git repo 中提取代码?
- splunk - 给定时间段内所有事件的数值总和
- javascript - 货币符号的 JavaScript Concat 问题