Forked from the brilliant zombiezen original: Experiment generating nicer api.

go get


Alternative API generator for go-capnproto2

This is a drop in replacement for the capnpc-go code generator in

It generates an API that has functions that panic where the original would have returned an error. This makes it less cumbersome to access fields in decoded messages. The errors that were returned were largely of 3 categories:

  • programming errors
  • allocation failures
  • corrupt structures because of decoding corrupt messages

In all cases, it is more convenient to deal with them in a defer/recover.

defer() func(){
    if err := recover(); err != nil {
        // handle err

Getting started

Familiarize yourself with

Install this code generator

go get -u

Instead of

capnp compile -ogo ....


capnp compile -ogo-panic ....

Read the godoc of your generated code to see what the api looks like.