Printing a nil slice also get the same output []. I remembered Rob Pike ever said in an issue thread that this can't be changed now for compatibility reason.
On Monday, March 15, 2021 at 8:18:46 AM UTC-4 Brian Candler wrote: > I was slightly surprised to discover that the Print() output for an empty > slice, and a 1-element slice containing the empty string, are the same: > > https://play.golang.org/p/btkzgk4LMT9 > > It does follow logically from the rules > <https://golang.org/pkg/fmt/#hdr-Printing>. I guess I need to train > myself to use %q or %#v. > -- 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/8531b38b-cffe-4d47-8dcf-9d4a45a6da3cn%40googlegroups.com.