-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make non recursive resolve print the result #2283
Conversation
I think this should be the default behavior of the function https://github.com/ipfs/go-ipfs/blob/5274ad9e8f71bd0b022863622c680ed07710d76f/namesys/namesys.go#L59 when the depth is 1, instead of a ux tweak that is only in core/commands. |
It is tested with it returning value and error so I assumed it is intentional. If there is no error returned then you can't know if it was full resolution or not via API, via CLI it is more important to show significant result than to error out (as only one of them can be shown). In API you can send both and if someone is setting low recursion limit (1) he just might want to check what was the result. (Travis fail is not connected). |
https://github.com/ipfs/go-ipfs/blob/5274ad9e8f71bd0b022863622c680ed07710d76f/namesys/base.go#L32 assumes that depth begins at > 1, and hence the err. The fix should be to not return the err when the depth begins at 1 (nonrecursive) for both the API/CLI and library interface. edit: s|API and CLI|API/CLI and library interface| |
As I said, IMHO returning error with the result is good idea in API as it gives more information (you know that resolution hasn't finish. So I see no reason to change the API only CLI (as it can show result or error) should show result when non-recursive resolution is requested. |
If the returned path of a nonrecursive resolve is an ipns path, then this is sufficient information that the resolve hasn't reached an ipfs path yet. An error message is not necessary in this case, which is the fix proposed in this PR, but is only done for the CLI and API. While I think it should also be the case for any libraries calling the namesys.ResolveN. |
The |
Clarification: changing |
I mean, if depth == 1 {
return ns.resolveOnce(ctx, name)
} should precede https://github.com/ipfs/go-ipfs/blob/5274ad9e8f71bd0b022863622c680ed07710d76f/namesys/namesys.go#L59 so that any libraries using |
8bd6889
to
3fc0a23
Compare
Rebased |
@Kubuxu rebase once more and i'll merge it, i promise! |
Currently it prints out error message but should just print the intermediate result as it is what we expect. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
3fc0a23
to
e8a49d9
Compare
Rebased. |
Currently it prints out error message but should just print
the intermediate result as it is what we expect.
License: MIT
Signed-off-by: Jakub Sztandera kubuxu@gmail.com