运行时:go 
api_version:go2
#vm:true

处理程序:
- url:/.*
脚本:_go_app

让我知道您是否有任何问题!

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.

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

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:

vm:trueenv:flex

Let me know if you have any questions!

这篇关于“App Engine灵活环境”中的Google App Engine导入问题(golang) (以前称为“管理的VM”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!