0
votes

I am developing an API in golang directly on the "App Engine flexible environment" (formerly known as "Managed VMs").

So far, i have been using this kind of import in my .go files :

import ( 
        "appengine"
        "appengine/datastore"
        ...)

Recently I decided to use Google Cloud Storage to store images. It requires the import of "cloud.google.com/go/storage". My problem is that i'm unable to deploy the app with this import (not found), or any other short version ("go/storage") like I use for the appengine import.

After much research, I found this : https://github.com/golang/appengine#user-content-3-update-code-using-deprecated-removed-or-modified-apis

It specifies how to migrate an application using short imports (deprecated, like mine) to full imports (with repository explicit like "google.golang.org/appengine")

I followed the procedure and used the script they provide to update my code (aefix). They also say to add this line to my app.yaml file :

vm : true

If I do, I got this error message running 'gcloud app deploy' :

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.

If I don't, none of my imports are working and I get the following error :

can't find import: "google.golang.org/appengine/datastore"

Here is my app.yaml file :

runtime: go
api_version: go2
#vm : true

handlers:
   - url: /.*
   script: _go_app

Of course, all the imports are on the server under $GOPATH/src/ so they're not really missing, more badly referenced I guess.

I'm stuck on this problem since several days, any help of any kind would be appreciated !

Thanks

1

1 Answers

0
votes

So sorry - we have some docs to go update. You cannot use the golang/appengine package with the App Engine flexible environment. The aefix tool won't work here either. Instead of the App Engine Go SDK, you want to use the Go client library here:

https://github.com/GoogleCloudPlatform/google-cloud-go

If you were previously using vm:true, you will need to upgrade to env:flex - the instructions (and the note on the go app engine library) are here:

https://cloud.google.com/appengine/docs/flexible/go/upgrading

Let me know if you have any questions!