打印golang结构时,如何忽略String()方法?

Tim*_*ell 6 debugging go

我有一个golang结构,并创建了一个String()在程序正常运行中使用的方法.我现在想要查看结构的全部内容.我尝试了通常的%+v格式,但似乎使用该String()方法而不是向我显示所有字段.如何输出原始结构数据?

示例:https://play.golang.org/p/SxTVOtwVV-9

package main

import (
    "fmt"
)

type Foo struct {
    Jekyl string
    Hyde  string
}

func (foo Foo) String() string {
    return foo.Jekyl // how I want it to show in the rest of the program
}

func main() {
    bar := Foo{Jekyl: "good", Hyde: "evil"}
    fmt.Printf("%+v", bar) // debugging to see what's going on, can't see the evil side
}
Run Code Online (Sandbox Code Playgroud)

输出

good
Run Code Online (Sandbox Code Playgroud)

但我希望看到你没有实现String()方法

{Jekyl:good Hyde:evil}
Run Code Online (Sandbox Code Playgroud)