go-ipld-prime
go-ipld-prime copied to clipboard
Selector.Interests provides no way to return "nothing"
That is, returning an empty set from Selector.Interests()
currently means "all". There's no way to say "don't explore any sub-paths".
https://github.com/ipld/go-ipld-prime/blob/4acc5447a2efc98fa91a2396c43f570299b4a782/traversal/selector/selector.go#L84-L88
Hm, that sounds like a bug. You're sure an empty (rather than nil) list doesn't do what you want?
I'm fairly sure the relevant branches are here:
https://github.com/ipld/go-ipld-prime/blob/4acc5447a2efc98fa91a2396c43f570299b4a782/traversal/walk.go#L104-L108
and that returning an empty list should jump down to here and cause "don't explore any sub-paths" as desired.
(Also kinda weird if a selector was going to statically return nothing for interests though, isn't it?)
Ok, no, that's horrible. An empty list and a nil list should be the same thing. This is much worse and will likely fail in very strange ways.
I just read the docs.