inetaf / netaddr

Network address types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IPSet mysteriously does nothing on invalid inputs

danderson opened this issue · comments

If I AddRange an invalid range, IPSet does nothing, successfully. This is surprising, a more normal idiom in Go would be to have AddRange return an error, and have a MustAddRange that panics if you really want a shorthand.

It does make the builder more annoying to wield, since a bunch of common adders/removers can now fail, but that feels better to me than silently doing something surprising.

Both this (return an error instead of swallowing invalid input to IPSetBuilder) and the direction in #167 (fix an invalid input to IPPrefixFrom rather than return an error) feel locally reasonable, but they conflict philosophically. I'm not sure what the resolution is, but I'm not very comfortable about it.

Oh, and I see this is also now being discussed in #178. :)

I replied on #178 then.

Yeah, the resolution of this will be subsumed by what we decide our global behavior should be.