I've actually only used Go to *query* the datastore, so I haven't tried creating keys. However, a quick note that might be related:
If you are using the "Standard Environment": you can't use App Engine APIs outside of handlers, because you need a "real" App Engine context. Make a web request to your instance, or use a "backend" instance and do your initialization as part of the /_ah/start request.
If you are using the "Flexible Environment": You may need to use appengine.BackgroundContext() instead of context.Background(). See the docs for that package.