| 208 | } |
| 209 | |
| 210 | func GetDependencyByPath(dependencies []types.Dependency, path string) types.Dependency { |
| 211 | splitted := strings.Split(path, ".") |
| 212 | |
| 213 | var retDependency types.Dependency |
| 214 | searchDependencies := dependencies |
| 215 | for _, segment := range splitted { |
| 216 | var nextDependency types.Dependency |
| 217 | for _, dependency := range searchDependencies { |
| 218 | if dependency.Name() == segment { |
| 219 | nextDependency = dependency |
| 220 | break |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | // not found, exit here |
| 225 | if nextDependency == nil { |
| 226 | return nil |
| 227 | } |
| 228 | |
| 229 | searchDependencies = nextDependency.Children() |
| 230 | retDependency = nextDependency |
| 231 | } |
| 232 | |
| 233 | return retDependency |
| 234 | } |