I have a nested struct.
type ConfigOne struct {
// Daemon section from config file.
Daemon daemon
}
type daemon struct {
Loglevel int
Logfile
The %v
and %+v
formats use the value of String()
if the type implements it. Therefore, using %+v
on a type within the String()
function for that type causes infinite recursion. Instead of using %+v
in the String()
function, you'll have to construct your own string, showing the contents of the structure in whatever way you see fit.