为什么我无法使用&go; goapp deploy'到GAE,我得不到导入:" github.com/go-sql-driver/mysql"

时间:2014-03-26 22:47:56

标签: 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>去运行mygoprog.go

尝试部署到GAE时不会: C:\ mysql> goapp deploy

我重新安装了goappengine并从头开始使用已卸载和安装之间的清理注册表。 任何帮助将不胜感激。

github install命令: goapp获取github.com/go-sql-driver/mysql 也试过了 去获取github.com/go-sql-driver/mysql

源代码(我试过移动它,错误跟随移动到第11行或第2行或其他):

import (
    "database/sql"
    "io/ioutil"
    "encoding/json"
    "fmt"
    "net/http"
    "log"
)
import  _ "github.com/go-sql-driver/mysql"

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

环境变量: GOPATH = C:\ MySQL的\ GOROOT = C:\转到\

app.yml内容: 应用:熟练国家-521 版本:1 运行时:去 api_version:go1

处理程序: - 网址:/。*   脚本:_go_app

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

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

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

1 个答案:

答案 0 :(得分:1)

导入路径必须来自app.yaml所在的文件夹。所以你需要在那里移动github.com文件夹。 (类似问题:How to import local Golang package in GAE

注意:你永远不应该使用go可执行文件来测试你的App Engine,总是使用goapp工具。