MCPcopy Index your code
hub / github.com/go-task/task / listIntersection

Function listIntersection

signals_test.go:227–239  ·  view source on GitHub ↗

Return the intersection of the two lists: the elements that are present in both lists. The notion of presence is not with '=' but with string.Contains(l2, l1) FIXME this does not enforce ordering. We might want to support both.

(lines1, lines2 []string)

Source from the content-addressed store, hash-verified

225// The notion of presence is not with '=' but with string.Contains(l2, l1)
226// FIXME this does not enforce ordering. We might want to support both.
227func listIntersection(lines1, lines2 []string) []string {
228 intersection := []string{}
229 for _, l1 := range lines1 {
230 for _, l2 := range lines2 {
231 if strings.Contains(l2, l1) {
232 intersection = append(intersection, l1)
233 break
234 }
235 }
236 }
237
238 return intersection
239}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…