package fixture // Not compiled. A field is a sentence only if every write to a field of that // name is. The anonymous struct writes an error's text, positionally and by key. type Check struct{ Reason string } func good() Check { return Check{Reason: "this box has no secrets key"} } func positional(w int, err error) { box := struct{ Reason string }{err.Error()} jsonError(w, 400, box.Reason) } func keyed(w int, err error) { box := struct{ Reason string }{Reason: err.Error()} jsonError(w, 400, box.Reason) } func assigned(w int, err error, c Check) { c.Reason = err.Error() jsonError(w, 400, c.Reason) }