1
votes

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
I know next to zero about Go (just heard a podcast on it this morning), but looking at golang.org/doc/code.html#PackagePaths I wonder whether the underscore you have before the package path in your import statement is causing the issue?Clive van Hilten
Still no joy with or without the underscore. The code examples for that package around the net have the underscore.user3466312
Set GOOS and GOARCH in GOAPP.BAT in GAE directory, still doesn't work 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_amd64 set TERM=dumb set CC=gcc set GOGCCFLAGS=-g -O2 -m64 -mthreads set CXX=g++ set CGO_ENABLED=1user3466312

1 Answers

1
votes

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.