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)
| 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. |
| 227 | func 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…