Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

IPSet mysteriously does nothing on invalid inputs #141

Open
danderson opened this issue Feb 22, 2021 · 4 comments
Open

IPSet mysteriously does nothing on invalid inputs #141

danderson opened this issue Feb 22, 2021 · 4 comments

Comments

@danderson
Copy link
Member

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.

@josharian
Copy link
Collaborator

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.

@josharian
Copy link
Collaborator

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

@bradfitz
Copy link
Contributor

I replied on #178 then.

@danderson
Copy link
Member Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants