diff --git a/util/gutil/gutil_dump.go b/util/gutil/gutil_dump.go index 4572ce1d9..642a01161 100644 --- a/util/gutil/gutil_dump.go +++ b/util/gutil/gutil_dump.go @@ -122,11 +122,7 @@ func doDump(value interface{}, indent string, buffer *bytes.Buffer, option doDum doDumpString(exportInternalInput) case reflect.Bool: - if reflectValue.Bool() { - buffer.WriteString(`true`) - } else { - buffer.WriteString(`false`) - } + doDumpBool(exportInternalInput) case reflect.Int, @@ -357,6 +353,19 @@ func doDumpString(in doDumpInternalInput) { } } +func doDumpBool(in doDumpInternalInput) { + var s string + if in.ReflectValue.Bool() { + s = `true` + } else { + s = `false` + } + if in.Option.WithType { + s = fmt.Sprintf(`bool(%s)`, s) + } + in.Buffer.WriteString(s) +} + func doDumpDefault(in doDumpInternalInput) { s := fmt.Sprintf("%v", in.Value) s = gstr.Trim(s, `<>`)