Golang is weird and allows you to call methods on a typed nil. Signed-off-by: Michael Dresser <michaelmdresser@gmail.com>
@@ -30,9 +30,12 @@ func (id *Identifier) Equal(ident Identifier) bool {
// String returns the string representation for the Identifier
func (id *Identifier) String() string {
- if id.Field == nil {
+ if id == nil {
return "<nil>"
}
+ if id.Field == nil {
+ return "<nil field>"
+ }
s := id.Field.Name
if id.Key != "" {
s += "[" + id.Key + "]"