aedeploy cloud app deploy – cannot find package

481 views
Skip to first unread message

Gabor Lenard

unread,
Aug 28, 2016, 6:12:06 AM8/28/16
to google-appengine-go
Hi,

I would like to migrate my existing classic Go appengine app to the Flexible environment. It works fine on my machine but when deployed to the flexible environment the build fails: it cannot find my package.

So I've created a mockup project to understand the issue. I have only three files here (apart from the Google sources):
  1. app.yaml with standard stuff, vm: true
  2. app.go which imports google.golang.org/appengine and calls appengine.Main(), and also imports my module “frontend"
  3. frontend/routes.go which handles “/“ 


This works on my machine with goapp serve (Python 2.7.10, Go 1.6.3 and App Engine SDK 1.9.40) but when I deploy it via aedeploy gcloud app deploy it stops with this error: 

Step 3 : RUN go-wrapper install -tags appenginevm
 ---> Running in 3f89c34cacb5
+ exec go install -v -tags appenginevm
app.go:6:2: cannot find package "frontend" in any of:
/usr/local/go/src/frontend (from $GOROOT)
/go/src/frontend (from $GOPATH)
/go/src/app/_gopath/src/frontend
The command '/bin/sh -c go-wrapper install -tags appenginevm' returned a non-zero code: 1
ERROR

ERROR: (gcloud.app.deploy) Error Response: [2] Build failed; check build logs for details
aedeploy: Error: unable to run "gcloud app deploy": exit status 1

What do I miss here?

Thanks,
Gabor

Gabor Lenard

unread,
Aug 28, 2016, 7:17:10 AM8/28/16
to google-appengine-go
Forgot to mention that the directory structure is like this:

appengine-aedeploy-test
-- src
---- app.yaml
---- app.go
---- frontend
------ routes.go

And local GOPATH is set to appengine-aedeploy-test



--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gabor Lenard

unread,
Aug 28, 2016, 7:40:17 AM8/28/16
to google-appengine-go
I have also implemented the structure recommended by Adam Tanner: https://groups.google.com/d/msg/google-appengine-go/xqqidgY_AiY/gnzqvwctBwAJ

This doesn’t seem to be compatible with the Flexible environment (even if I keep an empty app.yaml in the src directory), deploy cannot even start:

Old-Shatterhand:src gabor$ aedeploy gcloud app deploy frontend/frontend.yaml 
You are about to deploy the following services:
 - myapp/frontend/20160828t132320 (from [/private/var/folders/z3/w9x38yrj1ms9s8xzxpy6c41w0000gn/T/aedeploy061722956/frontend/frontend.yaml])

Do you want to continue (Y/n)?  


Beginning deployment of service [frontend]...
WARNING: Deployment of App Engine Flexible Environment apps is currently in Beta
ERROR: (gcloud.app.deploy) Your application does not satisfy all of the requirements for a runtime of type [go].  Please correct the errors and try again.
aedeploy: Error: unable to run "gcloud app deploy frontend/frontend.yaml": exit status 1

Gabor Lenard

unread,
Aug 30, 2016, 3:07:20 PM8/30/16
to google-appengine-go
Enclosing the module directory (frontend) inside a vendor directory solved the remote build problem. 
It looks like a hack but it works.

So this directory structure works both locally and remotely:

appengine-aedeploy-test  << this is in GOPATH

-- src
---- app.yaml
---- app.go
---- vendor
------ frontend
-------- routes.go




On 2016. Aug 28., at 13:17, Gabor Lenard <ga...@zenvite.com> wrote:

Gabor Lenard

unread,
Sep 2, 2016, 12:41:16 PM9/2/16
to google-appengine-go
Correction: the vendor directory only works if it is under the first path entry in GOPATH. 

If the GOPATH has multiple entries and the vendor directory is not below the first entry, then it doesn’t work at all. I cannot import the package as “my package”,  nor as “vendor/mypackage”. Haven’t red about this limitation anywhere and I don’t see any reason to handle the first entry differently in regards of the vendor directory so this looks like a bug or missing feature to me.

(Tested under Go 1.6.3 on OS X.)

Adam Tanner

unread,
Sep 2, 2016, 2:03:46 PM9/2/16
to Gabor Lenard, google-appengine-go
I think this might actually be an instance of this bug in aedeploy: https://code.google.com/p/googleappengine/issues/detail?id=12520

My general recommendation would be to set up your GOPATH to utilize full URLs in your package names.

$GOPATH
  src/
       main.go (imports "github.com/mycompany/myapp/frontend")
       frontend/
         routes.go

Gabor Lenard

unread,
Sep 2, 2016, 3:21:20 PM9/2/16
to Adam Tanner, google-appengine-go
Thank you, Adam, I am going to do that
Reply all
Reply to author
Forward
0 new messages