首页 > 解决方案 > 无法在 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

GOPATHC:\goSpaceGOROOT是 `C:\Go

标签: eclipsego

解决方案


推荐阅读