ModuleSetToDAG gets a DAG of the given ModuleSet. This only starts at target Modules. If a Module is not part of a graph with a target Module as a source, it will not be added.
(moduleSet ModuleSet, options ...ModuleSetToDAGOption)
| 217 | // This only starts at target Modules. If a Module is not part of a graph |
| 218 | // with a target Module as a source, it will not be added. |
| 219 | func ModuleSetToDAG(moduleSet ModuleSet, options ...ModuleSetToDAGOption) (*dag.Graph[string, Module], error) { |
| 220 | moduleSetToDAGOptions := newModuleSetToDAGOptions() |
| 221 | for _, option := range options { |
| 222 | option(moduleSetToDAGOptions) |
| 223 | } |
| 224 | graph := dag.NewGraph[string, Module](Module.OpaqueID) |
| 225 | for _, module := range ModuleSetTargetModules(moduleSet) { |
| 226 | if err := moduleSetToDAGRec(module, graph, moduleSetToDAGOptions.remoteOnly); err != nil { |
| 227 | return nil, err |
| 228 | } |
| 229 | } |
| 230 | return graph, nil |
| 231 | } |
| 232 | |
| 233 | // ModuleSetToDAGOption is an option for ModuleSetToDAG. |
| 234 | type ModuleSetToDAGOption func(*moduleSetToDAGOptions) |
searching dependent graphs…