Closed komuw closed 3 years ago
this is worse when the unit64's in question are large; uint64(17_898)
gets formatted as uint64(0x45ea)
If the maintainer/s of this repo do agree that this is worth doing, I would be happy to push a PR. the following diff seems like it might fix it:
diff --git a/format.go b/format.go
index 39cc8ab..056f791 100644
--- a/format.go
+++ b/format.go
@@ -35,6 +35,8 @@ func Format(v interface{}) string {
return "s" + quoteString(s)
case string:
return quoteString(v)
+ case uint64:
+ return fmt.Sprintf("%T(%d)", v, v)
}
if bytes, ok := byteSlice(v); ok && bytes != nil && utf8.Valid(bytes) {
// It's a top level slice of bytes that's also valid UTF-8.
Thanks for reporting, and yes please feel free to propose a PR! This seems to involve all uint types.
Tagged as v1.12.1.
Right now, if you have code like;
See: https://play.golang.org/p/MV6g6URN_Gy
It results in
In my opinion, formatting it as
uint64(17)
instead of the currentuint64(0x11)
would be much better