Hello,

I can print slices of bytes as hex strings, using code like the following:

x := []byte{0, 1, 2, 3}
fmt.Printf("%02x", x[:l])

This gives the output "00010203" as expected.  But this fails for the empty 
slice: running

    x := []byte{}
    fmt.Printf("%02x", x[:l])

gives "00" instead of the empty string.  See 
https://play.golang.org/p/rvLLqydDDE6 for a demonstration.

Is this a bug, or is this expected behaviour?

All the best,
Jochen


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bb8774f3-aa17-4044-8435-ed1cd162976cn%40googlegroups.com.

Reply via email to