For 0-9, add 0 before the number If it is 10 or more, it can be realized as follows if 0 is not added.
s := 3
str := fmt.Sprintf("%02d", s)
fmt.Println(str)
// 03
s2 := 13
str2 := fmt.Sprintf("%02d", s2)
fmt.Println(str2)
// 13
I realized it in the following roundabout way without knowing it, so it was a shock when I knew it ...
if num < 10 {
numStr = "0" + strconv.Itoa(num)
} else {
numStr = strconv.Itoa(num)
}