google-app-engine


Google App Engine Golang Imports not working


I am trying to use the datastore client library for golang, but it won't work. I downloaded it via the go -t command and also manually by downloading the github files. After the download I have copied the libraries into my google-cloud-sdk folder. But now when I try to start the dev_appserver.py there are so many missing packages. Do I have to import them all manually or is there an error?
You will need to setup go env. It seems you do not have go env setup.
For example:
11:35 $ go env
...
GOPATH="/Users/.../Goarea"
...
GOROOT="/usr/local/go"
Inside you GOPATH you would have bin/pkg/src. So when you do
go get -u cloud.google.com/go/datastore
It will be pulled to .../src/cloud.google.com/go/datastore
then you can import pkg and use it in your code.
package main
import (
"encoding/json"
"log"
"net/http"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
// Imports the Google Cloud Datastore client package.
"cloud.google.com/go/datastore"
"golang.org/x/net/context"
)
...
func main() {
ctx := context.Background()
projectID := "your id"
client, err := datastore.NewClient(ctx,
projectID, option.WithServiceAccountFile("YOUR CREDENTIAL.json"))
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
...
...

Related Links

Cant write cookies on live instance of google appengine
Google App Engine - Retrieving Parameters from URI in a doGet()?
How to detect if entity has no attribute (not model) in Google App Engine
GAE synchronized data with instances
How to increase GAE datastore index quota?
ndb independent transactions and retry
NDB querying a GenericProperty in repeated Expando StructuredProperty
objectify filter empty values
GAE error (<stderr>: SystemId Failed
Backend instance at custom domain
Manually add entity to empty Google App Engine DataStore
Google App Engine Log - ms and cpu_ms [duplicate]
unable to deploy after upgrading to 1.7.4
Model.get(list_of_keys) in a transaction, filtering a single entity group instead of throwing BadRequestError
Google app engine and JPA with Eclipse plug-in
Many-To-Many Relationships in Google App Engine Datastore (ndb)

Categories

HOME
embedded
xml
assembly
localization
adal
prism
telegram
pascal
replace
simulink
cq5
regular-language
frontend
fosrestbundle
augeas
g++
drop-down-menu
openpyxl
keytool
intershop
feathersjs
android-7.0-nougat
jersey-1.0
identity-management
ag
google-api-client
maze
licensing
delimiter
errbot
carrierwave
sqsh
constexpr
custom-controls
scrollview
volatile
complex-numbers
cognos-bi
autolisp
papaparse
android-gridview
dynamic-jasper
video-capture
git-rewrite-history
modernizr
password-protection
chef-solo
unordered-map
android-softkeyboard
placeholder
lampp
builder
custom-font
opengl-4
otp
mouseleave
shinobi
rxtx
chromium-os
redistributable
parfor
xcode-server
windows-azure-queues
jquery-jscrollpane
qiime
stream-processing
boost-serialization
phpwebsocket
nupic
halcon
httpruntime.cache
roadkill-wiki
forwarding
google-books
text-search
toolkit
batik
jsvc
snoop
ms-access-2000
kubuntu
zend-currency
public-html
adehabitathr
exceldatareader
variadic-templates
execve
spy++
wcm
tweenlite
gii
named-parameters
ss7
buffering
android-framework
maven-scm
websphere-esb
getopt
mbunit
kogrid
kaleidoscope
server-administration
booksleeve
device-width
paginator
fitbounds
urlrewriter
filemerge
xcelsius
google-floodlight
umra
cac
metaweblog
application-verifier
lxr
google-wave
application-planning
sqlobject
change-management
online-storage
cardspace

Resources

Encrypt Message