I'm playing with Google App Engine - Go version. I've tried to use one of the provided libraries and found out it doesn't work as I've expected.
A
appengine/remote_api
Client doesn't allow to connect to localhost and custom port, only default :80. I found a place in code responsible for handling localhost connection:
https://github.com/golang/appengine/blob/a5bf4a208e232b1d3d1c972da47afe05b2c5faa5/remote_api/client.go#L46
url := url.URL{ Scheme: "https", Host: host, Path: "/_ah/remote_api", } if host == "localhost" { // here's the reason url.Scheme = "http" }then open terminal, go to directory where main go_appengine package is unpacked
cd ~/Downloads/software/go_appengine find . -name remote_api vim ./goroot/src/pkg/appengine/remote_apiand replace the above line with:
if regexp.MustCompile(`^localhost(:\d{1,5})?$`).MatchString(host) {Check it here: http://play.golang.org/p/fMogPEfgc8
There's one more thing one has to do, install modified package so it's used:
goapp install ./goroot/src/pkg/appengine/remote_api/After this, if one run's
goapp run my_super_tool.go
it will use modified code.
Pull request to original project.
No comments:
Post a Comment