Google App Engine:无法导入Go包

时间:2013-10-17 15:38:33

标签: google-app-engine go

我正在尝试找到here的Google App Engine“hello world”示例。我正在使用Go语言,并完全遵循上述教程中给出的步骤。另外,我使用安装程序here安装了Go。我正在运行Windows 7 x64。

当我运行示例应用程序时,使用命令提示符:

dev_appserver.py c:\@Code\Go\myapp

我收到以下回复:

INFO     2013-10-17 11:17:00,497 sdk_update_checker.py:245] Checking for updates
 to the SDK.
INFO     2013-10-17 11:17:02,756 sdk_update_checker.py:273] The SDK is up to dat
e.
WARNING  2013-10-17 11:17:02,815 api_server.py:332] Could not initialize images
API; you are likely missing the Python "PIL" module.
INFO     2013-10-17 11:17:02,828 api_server.py:139] Starting API server at: http
://localhost:53563
INFO     2013-10-17 11:17:02,834 dispatcher.py:171] Starting module "default" ru
nning at: http://localhost:8080
INFO     2013-10-17 11:17:02,838 admin_server.py:117] Starting admin server at:
http://localhost:8000
ERROR    2013-10-17 11:17:02,905 go_runtime.py:165] Failed to build Go applicati
on: c:\@Code\Go\myapp\hello\hello.go:4: can't find import: "fmt"

2013/10/17 11:17:02 go-app-builder: build timing: 1×6g (16ms total), 0×gopack
(0 total), 0×6l (0 total)
2013/10/17 11:17:02 go-app-builder: failed running 6g.exe: exit status 1


(Executed command: C:\go_appengine\goroot\bin\go-app-builder.exe -app_base c:\@C
ode\Go\myapp -arch 6 -binary_name _go_app -dynamic -extra_imports appengine_inte
rnal/init -goroot C:\go_appengine\goroot -gcflags -I=C:\go_appengine\goroot\pkg\
windows_amd64_appengine -ldflags -L=C:\go_appengine\goroot\pkg\windows_amd64_app
engine -nobuild_files ^^$ -unsafe -work_dir c:\users\dennyc~1.sun\appdata\local\
temp\tmpr5dxl2appengine-go-bin hello\hello.go)

除了最后一个temp文件夹之外,上面的所有路径似乎都是有效的(虽然我不知道它们是什么意思)。正如您在sample app中看到的那样,fmt是第一个导入。如果我交换两个导入,我会得到相同的错误,但net/http

我知道Go已正确安装,因为我可以运行以下测试Go app:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

...直接来自Go。

我已经尝试搞乱所有各种环境变量无济于事。但是,看看测试Go应用程序将如何工作,我认为这与App Engine有关。

1 个答案:

答案 0 :(得分:3)

最近发布的Windows SDK(1.8.6)中存在一个错误。刚刚发布了一个修复该bug的新版本(1.8.6.1)。请尝试下载该版本。 https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go