(doc document.ComposeDocument, dependencyType, name string)
| 62 | } |
| 63 | |
| 64 | func dependencyLookup(doc document.ComposeDocument, dependencyType, name string) (*ast.MappingValueNode, string) { |
| 65 | files, _ := doc.IncludedFiles() |
| 66 | for u, file := range files { |
| 67 | for _, doc := range file.Docs { |
| 68 | if mappingNode, ok := doc.Body.(*ast.MappingNode); ok { |
| 69 | for _, node := range mappingNode.Values { |
| 70 | if s, ok := node.Key.(*ast.StringNode); ok && s.Value == dependencyType { |
| 71 | if m, ok := node.Value.(*ast.MappingNode); ok { |
| 72 | for _, service := range m.Values { |
| 73 | if s, ok := service.Key.(*ast.StringNode); ok && s.Value == name { |
| 74 | return service, u |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | return nil, "" |
| 84 | } |
no test coverage detected