Skip to content

Conversation

kellerza
Copy link

This masks certain struct keys.

The use case was to print a yang.Entry from https://github.com/openconfig/goyang

Each yang.Entry / yang.Node etc can have a parent which seems to recursively cause repr.Print to go into a loop
This now works with

repr.Println(e, repr.MaskKey("Parent"))

Open to change the name MaskKeys / HideKeys etc.
Could also use ... as you currently use in the seen logic

@alecthomas
Copy link
Owner

repr is supposed to detect recursive loops, we should fix that rather than adding extra functionality to work around that

@alecthomas
Copy link
Owner

Is it possible to provide a minimal working example for a case where the recursion detection fails?

@alecthomas
Copy link
Owner

There's an existing test for this exact scenario of parent references, so there must be something else going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants