I’m trying to debug a partial that uses the {{ return }} syntax.
I know that for regular partials, I can use {{ debug.Dump }} or {{ printf "%#v" . }} to inspect variables, but it seems like these methods don’t work with a partial that only returns a value.
Does anyone have a good method for debugging the value returned by a partial?
I’m working on a partial with multiple if-else statements and return statement because it’s called in several places to process images based on different condition, and I want to check which branch is being executed.
So does this mean that warnf is the only way to debug a partial that uses a return statement?
Also, Is there a better approach than relying on a partial with return for this?
the easiest while testing would be to use warnf (maybe combined with a math.Counter and the page and/or template path or remove the return temporarily.
or implement more comples tracing by saving steps in a Store or variable and return both
I went through the entire documentation again, and it seems that in Hugo the only way to return an object is indeed using return. As you mentioned, the only way to debug is either using warnf, returning the object, or save it using Store method.