shouldExcludeFile takes the map of all the matching target paths and the map of all the matching exclude paths for an image file and takes the union of the two sets of matches to return a bool on whether or not we should exclude the file from the image.
(
fileMatchingPathMap map[string]struct{},
fileMatchingExcludePathMap map[string]struct{},
)
| 203 | // exclude paths for an image file and takes the union of the two sets of matches to return |
| 204 | // a bool on whether or not we should exclude the file from the image. |
| 205 | func shouldExcludeFile( |
| 206 | fileMatchingPathMap map[string]struct{}, |
| 207 | fileMatchingExcludePathMap map[string]struct{}, |
| 208 | ) bool { |
| 209 | for fileMatchingPath := range fileMatchingPathMap { |
| 210 | for fileMatchingExcludePath := range fileMatchingExcludePathMap { |
| 211 | if normalpath.EqualsOrContainsPath(fileMatchingPath, fileMatchingExcludePath, normalpath.Relative) { |
| 212 | delete(fileMatchingPathMap, fileMatchingPath) |
| 213 | continue |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | // If there are no potential paths remaining, |
| 218 | // then the file should be excluded. |
| 219 | return len(fileMatchingPathMap) == 0 |
| 220 | } |
| 221 | |
| 222 | func getImageWithImports( |
| 223 | image Image, |
no test coverage detected
searching dependent graphs…