replace some basic uses of fmt.Sprintf()

Really tiny gains here, and doesn't significantly impact readability:

    BenchmarkSprintf
    BenchmarkSprintf-10    11528700     91.59 ns/op   32 B/op  1 allocs/op
    BenchmarkConcat
    BenchmarkConcat-10    100000000     11.76 ns/op    0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-06-12 18:19:50 +02:00
parent 8aee745ab2
commit f4bde68694
8 changed files with 8 additions and 9 deletions

View File

@ -133,7 +133,7 @@ func prettyPrintEvent(out io.Writer, event eventtypes.Message) error {
sort.Strings(keys)
for _, k := range keys {
v := event.Actor.Attributes[k]
attrs = append(attrs, fmt.Sprintf("%s=%s", k, v))
attrs = append(attrs, k+"="+v)
}
fmt.Fprintf(out, " (%s)", strings.Join(attrs, ", "))
}