You print the slice value. It is formatted / printed in print.go , the outstanding function printReflectValue() , currently line # 980:
855 func (p *pp) printReflectValue(value reflect.Value, verb rune, depth int) (wasString bool) {
and line # 995:
994 } else { 995 p.buf.WriteByte(']') 996 }
Please note that this is for βcommonβ fragments (for example, your []string ), byte sections are processed differently:
948 // Byte slices are special: 949 // - Handle []byte (== []uint8) with fmtBytes. 950 // - Handle []T, where T is a named byte type, with fmtBytes only
[]byte is printed in the unexcited function fmtBytes() :
533 func (p *pp) fmtBytes(v []byte, verb rune, typ reflect.Type, depth int) { // ... 551 } else { 552 p.buf.WriteByte('[') 553 } // ... 566 } else { 567 p.buf.WriteByte(']') 568 }
source share