douwen4125 2014-03-26 22:47
浏览 234

为什么我无法使用“ goapp deploy”将其部署到GAE,却找不到导入:“ github.com/go-sql-driver/mysql”

Main problem: can't deploy with 'goapp deploy' to GAE, keep getting this message:

src/mygoprog.go:11: can't find import: "github.com/go-sql-driver/mysql"

I have deployed 'hello world' program that listens on port 8080 to GAE with no problems; now trying to deploy a more sophisticated program.

This works just fine to test locally: C:\mysql\src>go run mygoprog.go

This does not when trying to deploy to GAE: C:\mysql>goapp deploy

I've reinstalled goappengine and go language from scratch with cleaned up registry between uninstall and install. Any help would be appreciated.

github install command(s): goapp get github.com/go-sql-driver/mysql also tried go get github.com/go-sql-driver/mysql

Source code (I've tried moving it around, the error follows the move to line 11 or 2 or whatever):

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

Environment: Python 2.7 Windows 7 - 64 bit goappengine sdk version 1.9.1 mercurial 2.9.1

Environment variables: GOPATH=C:\mysql\ GOROOT=C:\Go\

app.yml contents: application: skilled-nation-521 version: 1 runtime: go api_version: go1

handlers: - url: /.* script: _go_app

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This does not work: 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 ---

--- end server output --- error while running appcfg.py: exit status 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Directory structure of 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条回答 默认 最新

  • douyou2234 2014-04-01 09:20
    关注

    The import path must work from the folder where the app.yaml resides. So you need to move the github.com folder up there. (Similar question: How to import local Golang package in GAE)

    Note: You should never test your App Engine stuff with the go executable, always use the goapp tool.

    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能