Function
joinStrSlice
(slice []interface{}, sep string)
Source from the content-addressed store, hash-verified
| 161 | } |
| 162 | |
| 163 | func joinStrSlice(slice []interface{}, sep string) (string, error) { |
| 164 | var b strings.Builder |
| 165 | |
| 166 | for index, s := range slice { |
| 167 | |
| 168 | elem, ok := s.(string) |
| 169 | if !ok { |
| 170 | return "", fmt.Errorf("joinStrSlice argument must be a slice of strings") |
| 171 | } |
| 172 | |
| 173 | if index > 0 { |
| 174 | b.WriteString(sep) |
| 175 | } |
| 176 | |
| 177 | b.WriteString(elem) |
| 178 | } |
| 179 | |
| 180 | return b.String(), nil |
| 181 | } |
| 182 | |
| 183 | // Can make it easier to get the right number of line breaks |
| 184 | func nl() string { |
Callers
nothing calls this directly
Tested by
no test coverage detected