I've been using GAE for a number of months running a go webapp (pretty vanilla HTTP with a Gorilla MUX.) It has been working well. I've recently started to want to access some of the GAE services and so am trying to start to use the GAE go library. I also want to be able to develop offline ('cos I often work where networks are poor.)
I cannot seem to get my head around reworking my environment to succeed. When I make GAE calls (e.g. to memcache) I get told "not an App Engine context".
I've tried reading documentation and Googling but I cannot seem to find the pattern of setup I am missing, if one exists. Maybe I've painted myself into a corner somehow.
I've tried wrapping/replacing my context.Context via appengine.WithContext, and my HTTP request. That said, I continue to get the same error message.
I tried calling appengine.Main (as some search results suggested) in my main but things just hung badly. I don't know how to refactor to support that entry point, but maybe I need to learn.
Hmmm, reading the code comment inside appengine.Main I see a new path to try, refactor so that when running on GAE the code sets up http handlers (somehow) and dives into appengine.Main, and when not in GAE it runs my own HTTP server. I think I can try that. Does anybody know of a code example I can see to emulate?
Further question ... once I am, in appengine.Main will all contexts I get (from the HTTP requests) be ok for me to with.Context wrapper, to store my own values? (I've read some older postings that this breaks the appengine context.)
Any pointers would be really helpful. I've googled and found "Getting Started" and such, and some migration docs, but I'm starting to feel I'm unintentionally following an uncommon path.
BTW: Separately, it seems that memcache works on standard but not flex (hopefully that is correct) which makes me think maybe memcache isn't a good solution for long term. Is it deprecated in favor of something else, or what?
Thanks in advance for any suggestions.
regards,
Adam
--
Responserack
- incidents happen, response is crafted...