Go 1 Beta App Engine SDK

2,945 views
Skip to first unread message

Andrew Gerrand

unread,
Feb 2, 2012, 12:10:59 AM2/2/12
to google-appengine-go
Hello Go runtime users,

As you may know, the Go developers intend to launch Go 1 in the coming
weeks. In preparation for this we are providing a beta version of the
Go 1 runtime (go1beta). This will allow you to test your apps under
the new Go 1 runtime.

The go1beta runtime should be considered unstable and should not be
used for production apps. Before the Go 1 launch we may make changes
that cause go1beta apps to fail without notice.

You may download the beta SDK from the appengine-go project:
http://code.google.com/p/appengine-go/downloads/list

To use go1beta, update your app.yaml file to use the new api_version:
api_version: go1beta

The final Go 1 runtime will be api_version 'go1' and go1beta will be retired.

There are many backward-incompatible changes between api_version 3 and
go1beta. The SDK includes the gofix program to automatically update Go
code to use the new Go 1 and App Engine APIs. Some code may need to be
updated by hand, but all such cases should be flagged as compile
errors during testing or deployment.

Changes to the App Engine runtime between version 3 and go1beta are
described in the RELEASE_NOTES file in the root directory of the SDK.

The go1beta is currently based on Go weekly.2012-01-27, documented here:
http://weekly.golang.org/

Changes between Go release.r60.3 (the base for version 3) and
weekly.2012-01-27 are summarized in this document:
http://weekly.golang.org/doc/go1.html

Your feedback and bug reports are most appreciated.

Andrew

Rodrigo Moraes

unread,
Feb 2, 2012, 7:04:46 AM2/2/12
to google-appengine-go
Great. I like the changes in GetMulti, PutMulti and GetAll, and
dropping datastore.Time. :)

Would you consider some of the ideas I posted, e.g., making Query
immutable and splitting fetch options to a separate struct?

-- rodrigo

Rodrigo Moraes

unread,
Feb 2, 2012, 7:23:52 AM2/2/12
to google-appengine-go
And, more importantly, please give us a protobuf lib, so that we can
implement API stuff. :)

-- rodrigo

Arturo Vergara

unread,
Feb 2, 2012, 6:49:00 PM2/2/12
to google-appengine-go
Hello :)

Where did you see these changes? Are they in the standard GAE
documentation pages?

Rodrigo Moraes

unread,
Feb 2, 2012, 8:20:09 PM2/2/12
to google-appengine-go
On Feb 2, 9:49 pm, Arturo Vergara wrote:
> Hello :)
>
> Where did you see these changes? Are they in the standard GAE
> documentation pages?

It is in the "RELEASE_NOTES" file in the downloadable SDK. The source
code wasn't yet posted to http://code.google.com/p/appengine-go/

-- rodrigo

Andrew Gerrand

unread,
Feb 3, 2012, 8:01:20 AM2/3/12
to Rodrigo Moraes, google-appengine-go
On 2 February 2012 23:04, Rodrigo Moraes <rodrigo...@gmail.com> wrote:
> Would you consider some of the ideas I posted, e.g., making Query
> immutable and splitting fetch options to a separate struct?

The timing is getting a bit tight for the Go 1 launch. We're in API
freeze now until launch.

Andrew Gerrand

unread,
Feb 3, 2012, 8:01:57 AM2/3/12
to Rodrigo Moraes, google-appengine-go
On 2 February 2012 23:23, Rodrigo Moraes <rodrigo...@gmail.com> wrote:
> And, more importantly, please give us a protobuf lib, so that we can
> implement API stuff. :)

We're still exploring this, but this wouldn't be a
backward-incompatible change so it can happen after the Go 1 launch.

Thanks for your patience,
Andrew

Rodrigo Moraes

unread,
Feb 3, 2012, 8:49:12 AM2/3/12
to google-appengine-go
On Feb 3, 11:01 am, Andrew Gerrand wrote:
> The timing is getting a bit tight for the Go 1 launch. We're in API
> freeze now until launch.

Any of you have a draft for the cursor API? I'm curious about how you
plan to fit it.

-- rodrigo

Arturo Vergara

unread,
Feb 5, 2012, 11:11:13 PM2/5/12
to google-ap...@googlegroups.com
Thanks, saw them now :)

Arturo Vergara

unread,
Feb 5, 2012, 11:20:06 PM2/5/12
to google-ap...@googlegroups.com, Rodrigo Moraes
The only functionality I would miss (even though deprecated) is datastore.Map. I used it to flexibly load various entity types I originally saved from structs (which would all fall under an "Item" category), and then encode them into JSON. Initially I did this as a hacky solution so I could query all of those entity types at the same time and encode them all at once into a neat JSON response.
The downsides of using a datastore.PropertyList are:
  • It doesn't support slices (which I guess is ok when saving into the datastore, but not loading from it)
  • When I encode a PropertyList into JSON I get the representation of the properties stored in the lists, adding various levels of undesired complexity into my JSON
What's a good way of accomplishing what I did with datastore.Map with go1beta? I'm looking for a simple, generic key-value datatype to store query results.
If necessary, I'll start a new thread and provide more details.

Thank you in advance.

Nigel Tao

unread,
Feb 6, 2012, 6:49:38 PM2/6/12
to google-ap...@googlegroups.com
On 6 February 2012 15:20, Arturo Vergara <songoft...@gmail.com> wrote:
> What's a good way of accomplishing what I did with datastore.Map with
> go1beta? I'm looking for a simple, generic key-value datatype to store query
> results.

Just define your own map type that implements PropertyLoadSaver. Something like:

type Map map[string]interface{}

func (m Map) Load(c <-chan datastore.Property) error {
for p := range c {
if p.Multiple {
return errors.New("Map does not support
multiple properties")
}
m[p.Name] = p.Value
}
return nil
}

func (m Map) Save(c chan<- datastore.Property) error {
defer close(c)
for k, v := range m {
c <- datastore.Property{
Name: k,
Value: v,
}
}
return nil
}

Nigel Tao

unread,
Feb 6, 2012, 6:50:09 PM2/6/12
to Rodrigo Moraes, google-appengine-go
On 4 February 2012 00:49, Rodrigo Moraes <rodrigo...@gmail.com> wrote:
> Any of you have a draft for the cursor API? I'm curious about how you
> plan to fit it.

It's on my list of things to do, but I don't have anything to share yet.

Arturo Vergara

unread,
Feb 6, 2012, 8:25:17 PM2/6/12
to google-ap...@googlegroups.com
Wow, thanks so much :) it works great!
Unfortunately, I still face the problem of not being able to load slices (which were stored from structs), do you have any idea of how I would have to go about doing that?

Thank you in advance.

Nigel Tao

unread,
Feb 6, 2012, 8:53:59 PM2/6/12
to google-ap...@googlegroups.com
On 7 February 2012 12:25, Arturo Vergara <songoft...@gmail.com> wrote:
> Unfortunately, I still face the problem of not being able to load slices
> (which were stored from structs), do you have any idea of how I would have
> to go about doing that?

Look for the p.Multiple field in the property. If present, set the map
value to a []T instead of a T, where T is the type of p.Value. If the
map already has an slice value for that key, append the value to the
existing slice.

You will have to use the reflect package.

Arturo Vergara

unread,
Feb 6, 2012, 10:14:57 PM2/6/12
to google-ap...@googlegroups.com
Great, thanks :) I've got it to correctly check if it is a slice and if it isn't, assign it a slice with p.Value as the first element. However, when I try to append data into it, Go complains like this: "first argument to append must be slice; have interface {}"

Here is my code (you are welcome to point out any mistakes I may have made, or if this isn't the best way to do it):

if p.Multiple {
    kindOfMapValue := reflect.ValueOf(m[p.Name]).Kind() // get the kind of the value currently stored in the map
    if kindOfMapValue != reflect.Slice { // check if it isn't a slice
        m[p.Name] = []interface{}{p.Value} // assign it a slice with p.Value as the first element
    } else {
        m[p.Name] = append(m[p.Name], p.Value) // this is where Go complains
    }
}

Thank you in advance.

Arturo Vergara

unread,
Feb 6, 2012, 10:21:55 PM2/6/12
to google-ap...@googlegroups.com
Sorry to bother you all again,

I got it to work with a type assertion, but I feel it's kinda hacky, I would really appreciate it if you could tell me if this is the best way to do it.
Here is my code:

if p.Multiple {
    kindOfMapValue := reflect.ValueOf(m[p.Name]).Kind()
    if kindOfMapValue != reflect.Slice {
        m[p.Name] = []interface{}{p.Value}
    } else {
        m[p.Name] = append(m[p.Name].([]interface{}), p.Value) // type assertion of []interface{}
    }
}

Thank you in advance, and sorry for all of these posts.

Nigel Tao

unread,
Feb 7, 2012, 1:49:17 AM2/7/12
to google-ap...@googlegroups.com
On 7 February 2012 14:21, Arturo Vergara <songoft...@gmail.com> wrote:
> I got it to work with a type assertion, but I feel it's kinda hacky,

Oh, I was imagining that you'd want the values to be things like []int
or []string.

If you're happy with a map[string][]interface (and note the second
"[]"), then that's easy:

m[p.Name] = append(m[p.Name], p.Value)

Vitaly

unread,
Feb 10, 2012, 4:39:08 PM2/10/12
to google-appengine-go
Hello!

Is it possible to use the go command to build my appengine
application?

environment variables are set like below

export GOROOT=/.../google_appengine_go1beta/goroot
export GOBIN=$GOROOT/bin
export PATH=$GOBIN:$PATH
export GOPATH=/.../my_app

the go command is copied from the latest weekly goroot into the $GOBIN
dir


The result is the build error:
imports appengine
imports appengine_internal: /.../google_appengine_go1beta/user/
user.go:12:2: package could not be found locally

the appengine_internal packages are not listed in the output of the
"go list std" command.

Thanks,
Vitaly

David Symonds

unread,
Feb 10, 2012, 10:55:20 PM2/10/12
to Vitaly, google-appengine-go
On Sat, Feb 11, 2012 at 8:39 AM, Vitaly <vital...@gmail.com> wrote:

> Is it possible to use the go command to build my appengine application?

Maybe someday, but not yet.


Dave.

Vitaly

unread,
Feb 11, 2012, 2:28:44 AM2/11/12
to google-appengine-go
> Maybe someday, but not yet.

I tried to invoke the go build command from the TextMate bundle to
navigate to compilation errors within the editor.
It seems there is funny workaround:
the "curl localhost:8080" returns errors in the appropriate format
"filename:line: description".
So I build with curl until someday :)

It seems the Go app engine SDK in combination with gocode and textmate
gives me more convenient and definitely faster way to develop than the
java based solutions.

Thanks a lot!

David Symonds

unread,
Feb 12, 2012, 7:51:47 PM2/12/12
to google-appengine-go
Hi folks,

I've just uploaded new versions of the go1beta SDKs to
http://code.google.com/p/appengine-go/downloads/list, based on
weekly.2012-02-07. The production environment will be updated later
today without further notice.

Enjoy!


Dave.

Ugorji Nwoke

unread,
Feb 13, 2012, 8:22:28 AM2/13/12
to google-ap...@googlegroups.com
Thanks much David for including the appengine_internal/* in it. Much appreciated.

Rodrigo Moraes

unread,
Feb 13, 2012, 2:46:49 PM2/13/12
to google-appengine-go
On Feb 13, 11:22 am, Ugorji Nwoke wrote:
> Thanks much David for including the appengine_internal/* in it. Much
> appreciated.

wooo. good news.

David Symonds

unread,
Feb 19, 2012, 10:55:34 PM2/19/12
to google-appengine-go
The go1beta3 SDK has just appeared on
http://code.google.com/p/appengine-go/downloads/list, based on
weekly.2012-02-14 (well, just a bit after it). Production should be
updated later today.


Dave.

Alexandru Moșoi

unread,
Mar 4, 2012, 11:10:40 AM3/4/12
to google-appengine-go
Unfortunately a bug sneaked in which I is already fixed in the Go
repository.

$ go help
Go is a tool for managing Go source code.

Usage: go command [arguments]

The commands are:
panic: template: top:6: wrong number of args for Run: want 2 got 0

goroutine 1 [running]:
main.tmpl(0xf84007f420, 0xf840094008, 0x71135c, 0x195, 0x59a938, ...)
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:185 +0x28d
main.printUsage(0xf84007f420, 0xf840094008)
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:198 +0x9a
main.help(0xf840082020, 0x0)
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:209 +0x60
main.main()
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:113 +0x11b
alexandru@alexandru:~/source/ofidian/src/ofidian$ go help importpath
panic: template: top:1: wrong number of args for Run: want 2 got 0

goroutine 1 [running]:
main.tmpl(0xf84007f420, 0xf840094008, 0x7045bc, 0x3d, 0x6556d8, ...)
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:185 +0x28d
main.help(0xf84007f080, 0x100000001)
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:231 +0x514
main.main()
/tmp/appengine/google_appengine/goroot/src/cmd/go/main.go:113 +0x11b

On Feb 20, 4:55 am, David Symonds <dsymo...@golang.org> wrote:
> The go1beta3 SDK has just appeared onhttp://code.google.com/p/appengine-go/downloads/list, based on

David Symonds

unread,
Mar 4, 2012, 5:44:38 PM3/4/12
to Alexandru Moșoi, google-appengine-go
On Mon, Mar 5, 2012 at 3:10 AM, Alexandru Moșoi <brt...@gmail.com> wrote:

> Unfortunately a bug sneaked in which I is already fixed in the Go repository.

Yes, that has already been reported. It will be fixed in the next SDK.

Victor Song

unread,
Mar 9, 2012, 10:40:17 PM3/9/12
to google-ap...@googlegroups.com
Is gofix missing in beta3?

dave.a...@gmail.com

unread,
Mar 18, 2012, 12:26:20 AM3/18/12
to google-ap...@googlegroups.com
On Sunday, March 4, 2012 5:44:38 PM UTC-5, David Symonds wrote:
On Mon, Mar 5, 2012 at 3:10 AM, Alexandru  Moșoi  wrote:

> Unfortunately a bug sneaked in which I is already fixed in the Go repository.

Yes, that has already been reported. It will be fixed in the next SDK.


Related, and perhaps already reported:

The template use in demos/moustachio/moustachio/http.go is incorrect.  
   template.MustParseFile(x, nil)
should be:
   template.Must(template.ParseFiles(x))

  -Dave


David Symonds

unread,
Mar 18, 2012, 7:55:09 PM3/18/12
to dave.a...@gmail.com, google-ap...@googlegroups.com
On Sun, Mar 18, 2012 at 3:26 PM, <dave.a...@gmail.com> wrote:

> Related, and perhaps already reported:
>
> The template use in demos/moustachio/moustachio/http.go is incorrect.
>    template.MustParseFile(x, nil)
> should be:
>    template.Must(template.ParseFiles(x))

The Moustachio example is very broken. I'll fix it for the next SDK release.


Dave.

David Symonds

unread,
Mar 28, 2012, 6:09:08 PM3/28/12
to google-appengine-go
As a heads-up for anyone who was using go1beta: Later today I will be
disabling app uploads for apps that say "api_version: go1beta" in
their app.yaml, though existing go1beta apps will keep working for a
little while longer (O(days)). It should be trivial to bump your app
to "api_version: go1" with the official SDKs now.


Thanks all,

Dave.

Reply all
Reply to author
Forward
0 new messages