MCPcopy Index your code
hub / github.com/coder/coder / trimStringSlice

Function trimStringSlice

coderd/mcp.go:1315–1326  ·  view source on GitHub ↗

trimStringSlice trims whitespace from each element and drops empty strings.

(ss []string)

Source from the content-addressed store, hash-verified

1313// trimStringSlice trims whitespace from each element and drops empty
1314// strings.
1315func trimStringSlice(ss []string) []string {
1316 if ss == nil {
1317 return nil
1318 }
1319 out := make([]string, 0, len(ss))
1320 for _, s := range ss {
1321 if trimmed := strings.TrimSpace(s); trimmed != "" {
1322 out = append(out, trimmed)
1323 }
1324 }
1325 return out
1326}
1327
1328// coalesceStringSlice returns ss if non-nil, otherwise an empty
1329// non-nil slice. This prevents pq.Array from sending NULL for

Callers 2

createMCPServerConfigMethod · 0.85
updateMCPServerConfigMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected