Closed Dieterbe closed 1 year ago
2nd unrelated question, but when using custom String(), why is it still printing the "(main.foo) " prefix, and only for the first element? can this be stopped? thanks
D'oh. I just realized my silly mistake. Once String()
is called, execution is outside the purview of spew. So I should maintain my own indent logic, and do the recursive calls via a function that can take an indentation level.
something like this : https://play.golang.com/p/Fmy8IEen138
Hello, i'm probably missing something really obvious. it's been a while since i wrote Go and used spew last. (btw, i've been using it for years in many projects ! :) ) but when I have a type with a custom String() method, it seems spew no longer adds its own indentation see https://play.golang.com/p/5CQKeUh6d9V am i supposed to manually track which level i'm in, and add the indentation myself? the String() method has no parameter to pass in an indentation level.
when you remove the custom String() method, indentation is correct again..