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)
| 204 | // string.Contains(l2, l1). |
| 205 | // FIXME this does not enforce ordering. We might want to support both. |
| 206 | func 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) |
no outgoing calls
no test coverage detected
searching dependent graphs…