https://go.dev/play/p/yAGvguDS5Uc
slice := []byte("hello")
for i := range slice {
fmt.Printf("%[1]q\t%02[1]x\n", slice[:len(slice)-1-i])
}
"hell" 68656c6c
"hel" 68656c
"he" 6865
"h" 68
"" 00
The fmt docs don't go into detail on exactly what Printf should do here, but the behavior in the zero case is surprisingly non-monotonic, and seems to me to be a bug.