为什么可以';使用';goapp部署&x27;为了GAE,我可以';“找不到导入:”;github.com/go-sql-driver/mysql";

为什么可以';使用';goapp部署&x27;为了GAE,我可以';“找不到导入:”;github.com/go-sql-driver/mysql";,mysql,google-app-engine,deployment,go,Mysql,Google App Engine,Deployment,Go,主要问题:无法将“goapp deploy”部署到GAE,请继续收到以下消息: src/mygoprog.go:11:找不到导入:“github.com/go-sql-driver/mysql” 我已经部署了“hello world”程序,可以在8080端口监听GAE,没有问题;现在正试图部署一个更复杂的程序 在本地进行测试时,这种方法效果很好: C:\mysql\src>go运行mygoprog.go 当尝试部署到GAE时,这不起作用: C:\mysql>goapp部署 Results: 05

主要问题:无法将“goapp deploy”部署到GAE,请继续收到以下消息:

src/mygoprog.go:11:找不到导入:“github.com/go-sql-driver/mysql”

我已经部署了“hello world”程序,可以在8080端口监听GAE,没有问题;现在正试图部署一个更复杂的程序

在本地进行测试时,这种方法效果很好: C:\mysql\src>go运行mygoprog.go

当尝试部署到GAE时,这不起作用: C:\mysql>goapp部署

Results:
05:20 PM Application: skilled-nation-521; version: 1
05:20 PM Host: appengine.google.com
05:20 PM
Starting update of app: skilled-nation-521, version: 1
05:20 PM Getting current resource limits.
05:20 PM Scanning files on local disk.
05:20 PM Cloning 23 application files.
05:20 PM Compilation starting.
05:20 PM Compilation: 16 files left.
05:20 PM Error 422: --- begin server output ---
Compile failed:
2014/03/26 15:20:24 go-app-builder: build timing: 2├ù6g (171.487931ms total), 2├gopack (61.001119ms total), 0├ù6l (0 total)
2014/03/26 15:20:24 go-app-builder: failed running 6g: exit status 1



src/mygoprog.go:11: can't find import: "github.com/go-sql-driver/mysql"
--- end server output ---
05:20 PM Rolling back the update.
Error 422: --- begin server output ---
我重新安装了goappengine和go语言,在卸载和安装之间清理了注册表。 任何帮助都将不胜感激

github安装命令: goapp get github.com/go-sql-driver/mysql 也试过 获取github.com/go-sql-driver/mysql

源代码(我尝试过将其移动,移动到第11行或第2行或其他任何行后出现错误):

环境: Python 2.7 Windows 7-64位 goappengine sdk版本1.9.1 mercurial 2.9.1

环境变量: GOPATH=C:\mysql\ GOROOT=C:\Go\

app.yml目录: 应用:skilled-nation-521 版本:1 运行时间:开始 api_版本:go1

处理程序: -网址:/* 脚本:_go_应用程序

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 这不起作用: C:\mysql>goapp部署

Results:
05:20 PM Application: skilled-nation-521; version: 1
05:20 PM Host: appengine.google.com
05:20 PM
Starting update of app: skilled-nation-521, version: 1
05:20 PM Getting current resource limits.
05:20 PM Scanning files on local disk.
05:20 PM Cloning 23 application files.
05:20 PM Compilation starting.
05:20 PM Compilation: 16 files left.
05:20 PM Error 422: --- begin server output ---
Compile failed:
2014/03/26 15:20:24 go-app-builder: build timing: 2├ù6g (171.487931ms total), 2├gopack (61.001119ms total), 0├ù6l (0 total)
2014/03/26 15:20:24 go-app-builder: failed running 6g: exit status 1



src/mygoprog.go:11: can't find import: "github.com/go-sql-driver/mysql"
--- end server output ---
05:20 PM Rolling back the update.
Error 422: --- begin server output ---
---终端服务器输出--- 运行appcfg.py时出错:退出状态1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\mysql的目录结构:

C:\mysql>dir
 Volume in drive C is OS
 Volume Serial Number is D2E8-63AC

 Directory of C:\mysql

03/26/2014  05:14 PM    <DIR>          .
03/26/2014  05:14 PM    <DIR>          ..
03/25/2014  04:17 PM               119 app.yaml
03/26/2014  05:14 PM    <DIR>          pkg
03/26/2014  05:17 PM    <DIR>          src
               1 File(s)            119 bytes
               4 Dir(s)  20,781,137,920 bytes 


C:\mysql>cd src

C:\mysql\src>dir
 Volume in drive C is OS
 Volume Serial Number is D2E8-63AC

 Directory of C:\mysql\src

03/26/2014  05:17 PM    <DIR>          .
03/26/2014  05:17 PM    <DIR>          ..
03/26/2014  05:14 PM    <DIR>          github.com
03/26/2014  05:14 PM             2,666 mygoprog.go
               1 File(s)          2,666 bytes
               3 Dir(s)  20,781,387,776 bytes free

C:\mysql\src>cd github.com

C:\mysql\src\github.com>dir
 Volume in drive C is OS
 Volume Serial Number is D2E8-63AC

 Directory of C:\mysql\src\github.com

03/26/2014  05:14 PM    <DIR>          .
03/26/2014  05:14 PM    <DIR>          ..
03/26/2014  05:14 PM    <DIR>          go-sql-driver
               0 File(s)              0 bytes
               3 Dir(s)  20,781,387,776 bytes free
C:\mysql>dir
驱动器C中的卷是OS
卷序列号为D2E8-63AC
C:\mysql目录
2014年3月26日下午5:14。
2014年3月26日下午5:14。。
2014年3月25日04:17 PM 119 app.yaml
2014年3月26日下午5:14包装
2014年3月26日下午5:17 src
1个文件119字节
4个目录2078137920字节
C:\mysql>cdsrc
C:\mysql\src>dir
驱动器C中的卷是OS
卷序列号为D2E8-63AC
C:\mysql\src目录
2014年3月26日下午5:17。
2014年3月26日下午5:17。。
2014年3月26日下午5:14 github.com
2014年3月26日下午5:14 2666 mygoprog.go
1个文件2666字节
3 Dir(s)20781387776可用字节
C:\mysql\src>cd github.com
C:\mysql\src\github.com>dir
驱动器C中的卷是OS
卷序列号为D2E8-63AC
C:\mysql\src\github.com目录
2014年3月26日下午5:14。
2014年3月26日下午5:14。。
2014年3月26日下午5:14 go sql驱动程序
0个文件0个字节
3 Dir(s)20781387776可用字节

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

导入路径必须在app.yaml所在的文件夹中运行。因此,您需要将github.com文件夹移到上面。(类似问题:)


注意:永远不要用go可执行文件测试你的应用程序引擎,一定要使用goapp工具。

我对go几乎一无所知(今天早上刚刚听了一个播客),但是看看import语句中包路径之前的下划线是否导致了这个问题?带下划线还是不带下划线都没有乐趣。该网络包的代码示例在GAE目录的GOAPP.BAT中有下划线.Set GOOS和GOARCH,仍然不起作用C:\mysql>go env set GOARCH=amd64 set GOBIN=set GOCHAR=6 set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\mysql\set GORACE=set GOROOT=C:\go set GOTOOLDIR=C:\go\pkg\tool\windows\U amd64 set TERM=DUMBET set set set TERM=DUMBSET setCC=gcc set gogcclags=-g-O2-m64-mthreads set CXX=g++set CGO_ENABLED=1