[英]App Engine/Go: 'goapp serve' giving an error “Go application could not be built” error
I am trying to use Go with App Engine SDK for Go and when I run goapp serve
, I get the following error in printed the browser after going to http://localhost:8080 (I get similar errors in the terminal): 我试图将Go与App Engine SDK for Go一起使用,当我运行
goapp serve
,进入http:// localhost:8080后在打印浏览器时出现以下错误(在终端中出现类似错误):
The Go application could not be built.
无法构建Go应用程序。
(Executed command: C:\\go_appengine\\goroot\\bin\\go-app-builder.exe -app_base C:\\Projects\\Go\\Davilex -arch 6 -dynamic -goroot C:\\go_appengine\\goroot -nobuild_files ^^$ -unsafe -gopath C:\\Projects\\Go -print_extras_hash controllers\\form\\form.go main.go controllers\\pages\\pages.go models\\form.go)
(执行的命令:C:\\ go_appengine \\ goroot \\ bin \\ go-app-builder.exe -app_base C:\\ Projects \\ Go \\ Davilex -arch 6 -dynamic -goroot C:\\ go_appengine \\ goroot -nobuild_files ^^ $-不安全-gopath C:\\ Projects \\ Go -print_extras_hash controllers \\ form \\ form.go main.go controllers \\ pages \\ pages.go models \\ form.go)
2016/01/20 22:10:42 go-app-builder: Failed parsing input: parser: bad import "syscall" in colorable_windows.go from GOPATH
2016/01/20 22:10:42 go-app-builder:解析输入失败:解析器:GOPATH中colorable_windows.go中错误导入“ syscall”
Seems there is a somewhat similar question here a few days ago, with no resolve: bad import "syscall" for cloud storage APIs 似乎还有几分相似的问题在这里前几天,没有决心: 坏进口“系统调用”云存储API
At first I thought it was because I had both Python 2.7.x and 3.5.x installed and the the docs specifically say it will only work with v 2.7.x, so I uninstalled all 3.5.x references, removed the SDK and reinstalled it/unzipped/added its path to my PATH. 起初我以为是因为我同时安装了python 2.7.x和3.5.x,而文档专门说它只能在v 2.7.x上运行,所以我卸载了所有3.5.x参考,删除了SDK并重新安装了它。 /解压缩/将其路径添加到我的PATH。
I can run gcloud
, goapp
and go
all fine so everything should be set up correctly as far as I can tell, and just doing regular go run main.go
runs fine and works, but I can't seem to be able to use goapp serve
and I have no clue where to go about the error above. 我可以运行
gcloud
, goapp
和go
所有罚款,所以一切应正确,据我可以告诉,只是在进行常规设置go run main.go
运行正常和工作,但我似乎无法能够使用goapp serve
,我不知道该如何处理上述错误。
EDIT/SOLUTION 编辑/解决方案
I created a dummy project and just added this simple set of code into it: 我创建了一个虚拟项目,并向其中添加了以下简单代码集:
package main
import "net/http"
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!"))
}
And the error seems to have gone away and everything works fine. 而且错误似乎已经消失,并且一切正常。 So the problem must be occuring from either my code or my use of https://github.com/gin-gonic/gin package.
因此,问题一定是由于我的代码或使用https://github.com/gin-gonic/gin软件包引起的。
Hope that may help anyone with a similar problem. 希望对任何有类似问题的人有帮助。 Try creating another project and see if it works.
尝试创建另一个项目,看看是否可行。 If it does, you now know where the issue is coming from.
如果是这样,您现在就知道问题的根源。
I created a dummy project and just added this simple set of code into it: 我创建了一个虚拟项目,并向其中添加了以下简单代码集:
package main
import "net/http"
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!"))
}
And the error seems to have gone away and everything works fine. 而且错误似乎已经消失,并且一切正常。 So the problem must be occuring from either my code or my use of https://github.com/gin-gonic/gin package.
因此,问题一定是由于我的代码或使用https://github.com/gin-gonic/gin软件包引起的。
Hope that may help anyone with a similar problem. 希望对任何有类似问题的人有帮助。 Try creating another project and see if it works.
尝试创建另一个项目,看看是否可行。 If it does, you now know where the issue is coming from.
如果是这样,您现在就知道问题的根源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.