When fmt prints a slice, it formats each element individually, and if the element type implements fmt.Stringer, it calls String() on each one. So []ID{1, 2} renders as "[#1 #2]", with the brackets and spaces supplied by the slice formatter and #1/#2 supplied by ID.String().