cases: implement spanning

Also added a guards to gen.go as well as some other minor
improvements.

Change-Id: Ie9ac1fc74002aea4bcccf0ac6943bce0f327004a
Reviewed-on: https://go-review.googlesource.com/29170
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
8 files changed