• Eric Myhre's avatar
    Fix for empty string PathSegment. · 98fdaf17
    Eric Myhre authored
    Yep, it makes a lot of creation by struct uglier, as you can see in the
    diff to the test file.  Fortunately?  Nobody outside the package is
    allowed to do that anyway, so, we can pretty much ignore the ergonomic.
    (It'll still look uglier if someone's looking at stuff with spew or
    go-cmp or some other library like that which peeks naughtily into
    unexported fields, but that's hard to do much about.)
    
    We could also address this by adding a discriminant field to the
    PathSegment struct.  (If we wanted to use uint internally, we'd
    probably have to do that, in fact.  Either that or start using
    some other alarmingly magical number like UINT_MAX.  Ygh.)  I didn't.
    I don't think we handle lists larger than 2 billion elements
    particularly well anyway... so, adding more words of memory to
    PathSegment to support that case seems like an entirely losing trade.
    98fdaf17
pathSegment.go 4.78 KB