veyron/tools/debug: Fix debug's -raw flag for histograms
When the -raw flag is used, we want to see the raw histogram structure,
not the nicely formatted version. When the String() method was added to
HistogramValue, it broke the raw formatting.
This change restores the functionality by bypassing the String method.
Change-Id: I42992fa4d04595195cc0de0d4b36019fd71fe682
diff --git a/tools/debug/impl.go b/tools/debug/impl.go
index 6a5a1fa..e998831 100644
--- a/tools/debug/impl.go
+++ b/tools/debug/impl.go
@@ -417,15 +417,15 @@
fmt.Fprintf(&buf, "%T: ", value)
}
if raw {
+ if v, ok := value.(istats.HistogramValue); ok {
+ // Bypass HistogramValue.String()
+ type hist istats.HistogramValue
+ value = hist(v)
+ }
fmt.Fprintf(&buf, "%+v", value)
return buf.String()
}
- switch v := value.(type) {
- case istats.HistogramValue:
- v.Print(&buf)
- default:
- fmt.Fprintf(&buf, "%v", v)
- }
+ fmt.Fprintf(&buf, "%v", value)
return buf.String()
}