Hi,
I am trying to update/convert one of my relatively big apps to Go 1.11.
I would like to continue using the
google.golang.org/appengine package for now, and then slowly transition to the cloud apis once everything is working. The doc says this is still supported [2].
But I'm a bit confused by how I am supposed to do the development now. The short documentation just says "use go run" [1]. But I feel like a lot is missing.
I still need a dev server? Probably yes, at least I would love to still have one available (for the datastore and other apis). How do I run the binary exactly, do I need env variables set ?
If I just run the main, I get an error when trying to make a datastore query:
> env PORT=9090 go run main.go
2018/10/27 23:24:22 Listening on port 9090
goroutine 39 [running]:
net/http.(*conn).serve.func1(0xc00053c0a0)
/usr/local/epath/go/src/net/http/server.go:1746 +0xd0
panic(0xa609c0, 0xc0003f20e0)
/usr/local/epath/go/src/runtime/panic.go:513 +0x1b9
Out of desperation, I tried with dev_appserver.py, the above works, but I get another error during the datastore query: "not an App Engine context".
2018/10/28 06:49:09 panic occurred: not an App Engine context
goroutine 52 [running]:
panic(0xa93f40, 0xc0000b6ca0)
/usr/local/epath/go/src/runtime/panic.go:513 +0x1b9
This looks kind of expected to me, as it is indeed not an appengine context... Building without tags mean that appengine.NewContext is just an alias for context.Context. I also tried building with the appengine tag (using a bit of trickery...) but that doesn't work either since dev_appserver doesn't include the "appengine" package anymore [2], used by some of the files with the appengine build tag (e.g. [4])
So back to running main.go with go run. I just feel like I need to set some environment variables, other than just PORT. I couldn't find any documentation on that really. And also, once that is done, probably I should also run a dev server, so that my binary can use various services from it (users, datastore, task queues, etc -- again, I will migrate those later, as as I understand this is still supported)
What am I doing wrong or missing? :)
Thanks,