summaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-11 22:30:35 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-11 22:38:48 -0600
commit6fc5d416a289235dd4bb56d29fb96c5a003ea89f (patch)
treee35bb16c46c2ad8d8563b42e12a1e95cbd936dc7 /pkg/util
parentf1a212cddb8dc051c510327c365da42e30b23ab9 (diff)
use %v when possible
Exceptions are - the occasional %x when the type is a basic int - %w - %q - %T - whenever print_tree.go needs to be dumb for compatibility with C
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/bitfield.go2
-rw-r--r--pkg/util/fmt.go4
-rw-r--r--pkg/util/ref.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/pkg/util/bitfield.go b/pkg/util/bitfield.go
index 216837d..23da17a 100644
--- a/pkg/util/bitfield.go
+++ b/pkg/util/bitfield.go
@@ -36,7 +36,7 @@ func BitfieldString[T ~uint8 | ~uint16 | ~uint32 | ~uint64](bitfield T, bitnames
if i < len(bitnames) {
out.WriteString(bitnames[i])
} else {
- fmt.Fprintf(&out, "(1<<%d)", i)
+ fmt.Fprintf(&out, "(1<<%v)", i)
}
first = false
}
diff --git a/pkg/util/fmt.go b/pkg/util/fmt.go
index c0ff596..af7404c 100644
--- a/pkg/util/fmt.go
+++ b/pkg/util/fmt.go
@@ -16,13 +16,13 @@ func FmtStateString(st fmt.State, verb rune) string {
}
}
if width, ok := st.Width(); ok {
- fmt.Fprintf(&ret, "%d", width)
+ fmt.Fprintf(&ret, "%v", width)
}
if prec, ok := st.Precision(); ok {
if prec == 0 {
ret.WriteByte('.')
} else {
- fmt.Fprintf(&ret, ".%d", prec)
+ fmt.Fprintf(&ret, ".%v", prec)
}
}
ret.WriteRune(verb)
diff --git a/pkg/util/ref.go b/pkg/util/ref.go
index 57f2eac..aecfb9f 100644
--- a/pkg/util/ref.go
+++ b/pkg/util/ref.go
@@ -36,7 +36,7 @@ func (r *Ref[A, T]) Read() error {
return err
}
if n != size {
- return fmt.Errorf("util.Ref[%T].Read: left over data: read %d bytes but only consumed %d",
+ return fmt.Errorf("util.Ref[%T].Read: left over data: read %v bytes but only consumed %v",
r.Data, size, n)
}
return nil