Re:Spectro: Adventures in Go
by cespare on Sunday November 22, 2015 @01:06AM
(#10609236)
You can do better -- fmt provides a way to give a dynamic width or precision as an int argument.
I'd further wonder whether a separate padding calculation is needed at all (too lazy to go read the source on Github at the moment).
[ Parent
| on HN ]
I started with that, but there's no reason to use the formatting specifiers when the padding string is already blank. With the dynamic width Fprintf still needs to waste time parsing the format string.