Go app into GAE with gcloud

424 views
Skip to first unread message

Matías Blasi

unread,
May 9, 2015, 12:06:14 AM5/9/15
to google-ap...@googlegroups.com
Hi all, I have a Go application using martini.
I can launch it by running 'go run ...'.

Now, I'd like to run it in app engine, then I was following https://cloud.google.com/sdk/gcloud tutorial, and trying:

$ gcloud preview app run app.yml

Then I'm getting these kind of errors:

2015/05/07 09:40:29 go-app-builder: Failed parsing input: package "src/github.com/garyburd/redigo/redisx" cannot import internal package "github.com/garyburd/redigo/internal"

or

2015/05/07 09:40:29 go-app-builder: Failed parsing input: package "src/github.com/xxx/yyy" cannot import syscall


Finally, I tried to get all dependencies again using goapp binary from gcloud installation, and this error came:

$ goapp get (goapp is provided by gcloud installation)
go tool: no such tool "cgo"
(that kind of operation worked fine with go binary)

I can see a different amount of tools installed into Go tooldir and gcloud tooldir:

$ ls /home/matias/google-cloud-sdk/platform/google_appengine/goroot/pkg/tool/linux_amd64 (gcloud installation)
6g  6l  pack
$ ls /usr/lib/go/pkg/tool/linux_amd64/ (original go installation)
6a  6c  6g  6l  addr2line  cgo  dist  fix  nm  objdump  pack  pprof  yacc

I supouse cloud sdk is the next generation of app engine sdk, - or at least, a more complete version - , since the cloud one contains the same tools than the second one, plus others.

Is it the right way to use gcloud tool for running an app into GAE locally and deploying it into the cloud?

Regards,
Matías.

Glenn Lewis

unread,
May 9, 2015, 12:22:36 AM5/9/15
to Matías Blasi, google-appengine-go
Go on Managed VMs has not yet transitioned to using the external Go toolchain but will soon.

Your best bet at the moment is to use "runtime: custom" and build up your app with a custom Dockerfile.
-- Glenn

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matías Blasi

unread,
May 11, 2015, 8:42:36 AM5/11/15
to google-ap...@googlegroups.com, matias...@gmail.com
Thank you Glenn!

Is that true that the google cloud sdk replaces app engine sdk? (including serveral other functionalities)
Thinking in near future, about deploying applications for massive usage, is the cloud sdk the official advice?

Regards,
Matías.

Glenn Lewis

unread,
May 11, 2015, 6:15:06 PM5/11/15
to Matías Blasi, google-appengine-go
In the future, if you are developing Go apps on Managed VMs (vm: true), you will only need the Cloud SDK.
If you are developing "classic" Go on App Engine apps (vm: false), you will need the stand-alone Go App Engine SDK.
-- Glenn


Kun Li

unread,
May 11, 2015, 8:58:43 PM5/11/15
to Glenn Lewis, Matías Blasi, google-appengine-go
Isn't Go App Engine SDK also managed by gcloud?

Glenn Lewis

unread,
May 11, 2015, 11:02:17 PM5/11/15
to Kun Li, Matías Blasi, google-appengine-go
The Cloud SDK provides a "Go component" with the "gcloud" tool.  This component will be supporting Go on Managed VM apps.
The Go App Engine SDK is the classic stand-alone App Engine SDK for use with Go (before there was ever a Cloud SDK or "gcloud").
-- Glenn

Kun Li

unread,
May 12, 2015, 1:18:07 AM5/12/15
to Glenn Lewis, Matías Blasi, google-appengine-go
So basically it's gcloud for Managed VM and goapp for classic App Engine, correct?

Glenn Lewis

unread,
May 12, 2015, 1:20:16 AM5/12/15
to Kun Li, Matías Blasi, google-appengine-go
Yes

Matías Blasi

unread,
May 23, 2015, 10:02:51 AM5/23/15
to google-ap...@googlegroups.com, matias...@gmail.com
Hi!

Now, I'm just trying to launch the demo app https://github.com/golang/appengine/tree/master/demos/helloworld
I cloned it into /home/matias/sandbox/appengine/demos/helloworld
I set my GOPATH to there:

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/matias/sandbox/appengine/demos/helloworld"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="x86_64-pc-linux-gnu-gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

The first I tried is to run gcloud preview app run app.yaml command, and I get lots of 'cannot find package xxxx', then I run 'go get', to download dependencies, and it throws following error:
helloworld $ go get
go install: no install location for directory /home/matias/sandbox/appengine/demos/helloworld outside GOPATH
helloworld $ (the same with goapp get command)
Lots of packages got downloaded, but it looks like not enough, I'm still getting some 'cannot find pacakge':

helloworld $ gcloud preview app run app.yaml
INFO     2015-05-23 13:32:29,336 containers.py:280] 2015/05/23 13:32:29 Can't find package "golang.org/x/text/encoding" in $GOPATH: cannot find package "golang.org/x/text/encoding" in any of:
        /goroot/src/golang.org/x/text/encoding (from $GOROOT)
        /gopath/src/golang.org/x/text/encoding (from $GOPATH)
and lots of others...

What am I loosing?

Regards,
Matías.

Glenn Lewis

unread,
May 24, 2015, 11:42:14 AM5/24/15
to Matías Blasi, google-appengine-go
Please see the recent threads in this mailing list to get you unblocked.
If you are still having problems, please email me directly.
-- Glenn

--

lawren...@gmail.com

unread,
Jun 7, 2016, 2:45:57 PM6/7/16
to google-appengine-go

If you are using gosdk, just run goapp get in the same directory as your .go file and it will download and install the dependencies to your gosdk installation. You then deploy the app again and it should compile without problem.

When it's working there's no prompt and files will be downloaded to gosdk\gopath\src

After fininshing there will be a warning message which can be ignored:

go install: no install location for directory C:\your_current_directory outside GOPATH For more details see: go help gopath

Reply all
Reply to author
Forward
0 new messages