MCPcopy Create free account
hub / github.com/conforma/cli / joinStrSlice

Function joinStrSlice

internal/utils/templates.go:163–181  ·  view source on GitHub ↗
(slice []interface{}, sep string)

Source from the content-addressed store, hash-verified

161}
162
163func 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
184func nl() string {

Callers

nothing calls this directly

Calls 2

ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected