(parents []string, args ...string)
| 8 | type divider struct{} |
| 9 | |
| 10 | func (d divider) string(parents []string, args ...string) string { |
| 11 | var buffer bytes.Buffer |
| 12 | |
| 13 | for index, parent := range parents { |
| 14 | if index == 0 { |
| 15 | buffer.WriteString(parent) |
| 16 | } else { |
| 17 | buffer.WriteString(" <<< ") |
| 18 | buffer.WriteString(parent) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | for _, arg := range args { |
| 23 | if arg == "" { |
| 24 | continue |
| 25 | } |
| 26 | |
| 27 | if buffer.Len() == 0 { |
| 28 | buffer.WriteString(arg) |
| 29 | } else { |
| 30 | buffer.WriteString(" <<< ") |
| 31 | buffer.WriteString(arg) |
| 32 | } |
| 33 | } |
| 34 | return fmt.Sprintf("# -------- %s --------\n", buffer.String()) |
| 35 | } |
| 36 | |
| 37 | func newDivider(parents []string, args ...string) string { |
| 38 | return divider{}.string(parents, args...) |
no test coverage detected