I wonder why he didn't use the Builder-like approach used in the context package (https://golang.org/pkg/context/). It is more verbose to implement, but since this error package is used throughout upspin it sounds like a net win.
Edit: the With* functions in context is not exactly Builder-like since some of them return multiple values and cannot be chained. However, the error type doesn't suffer this. You can implement With* methods on the Error type and make the following possible:
Edit: the With* functions in context is not exactly Builder-like since some of them return multiple values and cannot be chained. However, the error type doesn't suffer this. You can implement With* methods on the Error type and make the following possible:
errors.New("message").WithKind(errors.Permission).WithOp("create")
Which is now completely type-safe, and only slightly more verbose than
errors.E("message", errors.Permission, errors.Op("create"))