[1/2] x/cli/output: Add an abstraction to take care of output rendering#27
Conversation
…fg in x/cli/output
7942bf2 to
60446cb
Compare
xgoffin
left a comment
There was a problem hiding this comment.
Honestly I understand nothing of any of this. I understand its purpose but how it gets there from a code standpoint? Nope.
I don't think it's worth changing code over this, but this desperately needs a "walkthrough" doc that says which bit is responsible for what. Also means I can't exactly review this.
| // Prefixed is an optional interface that a value passed to Walk can | ||
| // implement to inject dynamic key prefix segments. When Walk receives a | ||
| // Prefixed value it builds a synthetic ancestor chain from the prefix | ||
| // segments and walks the inner value returned by WalkValue. |
There was a problem hiding this comment.
I'll be 100% straight here: I have no idea what this means.
How about adding a little example to the comment? 🤔
There was a problem hiding this comment.
checkout ./configurator_test.go it explicit the behavour quite extensively
| enc.SetIndent("", " ") | ||
| } | ||
|
|
||
| return enc.Encode(v) //nolint:wrapcheck |
There was a problem hiding this comment.
We have several nolint:wrapcheck in the coming files: do they serve any purpose in asserting errors? Why put them and not simply a wrap?
| ) | ||
| ) | ||
|
|
||
| walker.Walk( //nolint:errcheck |
There was a problem hiding this comment.
Given that this is mostly printing, we can consider panicking if the Walk failed, but it is not a hill I will die on
| @@ -0,0 +1,156 @@ | |||
| package output_test | |||
There was a problem hiding this comment.
package output_test? 🤔 package output at the same level though. Either rename or add a layer?
There was a problem hiding this comment.
as this file implements some "integration" test i wanted to keep things separated to make sure there is no interference of same package private structs. As the whole shebang relies on quite a bit of reflection
What does this PR do?
A demo is worth 1000 words:
Imagine:
you can now have multi rendering codec program that are "unix philosophy ready".
What are the observable changes?
Good PR checklist
Additional Notes