Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this comment means that when we need to add some field in this struct.
So, I think this comment is still in the right place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @koba1t , and thanks for your review! I think I disagree with you on your point:
As far as I understand, the comment is applying to the pattern that is used to ensure that if functions are added to the
walk.Visitor
interface, the struct will still implement all of them (if not, the build will failed because of the linevar _ walk.Visitor = Merger{}
).And also the comment refers to the interface, which
Merger
is not (it is a struct), so again, the comment should apply to the line mentioned above.So if a new function is added on the
walk.Visitor
interface, the linevar _ walk.Visitor = Merger{}
will ensure that theMerger
struct is still (forward-)compatible with the interface, which is basically what the comment is saying.WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, Thanks for describing this code. I misunderstood
walk.Visitor
as not an interface.I agree with what you are doing now.