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

Function listDifference

signals_test.go:206–222  ·  view source on GitHub ↗

Return the difference of the two lists: the elements that are present in the first list, but not in the second one. 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

204// string.Contains(l2, l1).
205// FIXME this does not enforce ordering. We might want to support both.
206func listDifference(lines1, lines2 []string) []string {
207 difference := []string{}
208 for _, l1 := range lines1 {
209 found := false
210 for _, l2 := range lines2 {
211 if strings.Contains(l2, l1) {
212 found = true
213 break
214 }
215 }
216 if !found {
217 difference = append(difference, l1)
218 }
219 }
220
221 return difference
222}
223
224// Return the intersection of the two lists: the elements that are present in both lists.
225// The notion of presence is not with '=' but with string.Contains(l2, l1)

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…