In my Google App Engine project written in Go I've been using e.g.
import "appengine/datastore"
with success for a long time and assuming the import locates things where I have the App Engine SDK. However, now I want to use a third party library also from Google that uses things from App Engine as well, but imports with the full path:
import "google.golang.org/appengine"
Running the app
$ goapp serve
fails with not finding appengine:
...go/src/golang.org/x/oauth2/client_appengine.go:16: can't find import: "google.golang.org/appengine/urlfetch"
Can't find package "google.golang.org/appengine" in $GOPATH
Obviously I want to use the same App Engine parts to not have other problems. My first through is that I want to tell the third party library to use the App Engine SDK libraries, but I don't know how as it has a different prefix in the import.
Should I use the full path in my project for all App Engine imports? This would be opposite to what is in all what I have read on the Google's App Engine for Golang webpages. E.g. here.
Generally, what is the way to set up things so that it finds the right appengine libraries both in development and production on App Engine as well as from third party libraries?
Thanks in advance for any help!
UPDATE
I can also see that after adding the third party library and running go get
it fetched all kinds of stuff into $GOPATH/src/google.golang.org/api/...
. Lots of stuff there and appengine as well etc. It seems to be all Golang Google APIs...!
So it's not resolved but I have learned that there's a change that changes to fully qualified appengine import paths.
Now I have my app running locally as I pulled in the new appengine to satisfy the oauth library that uses the new import paths.
go get google.golang.org/appengine
According to this:
If you don't want to update your entire app to use the new App Engine packages, you may use both sets of packages in parallel, using only the new packages with the oauth2 package.
Actually very confusing and I don't know what is available when I deploy on App Engine. Does anyone know?
See Question&Answers more detail:
os