refactor: stringer

This commit is contained in:
Inanc Gumus
2019-10-17 20:23:45 +03:00
parent c062a46355
commit 47b24c7649
8 changed files with 41 additions and 19 deletions

View File

@ -8,7 +8,6 @@
package main
import (
"fmt"
"sort"
"strings"
)
@ -23,9 +22,13 @@ func (l list) String() string {
}
sort.Sort(l)
var str strings.Builder
for _, p := range l {
fmt.Fprintf(&str, "* %s\n", p)
// fmt.Printf("* %s\n", p)
str.WriteString("* ")
str.WriteString(p.String())
str.WriteRune('\n')
}
return str.String()
}