func()

in astro/execution_set.go [65:93]


func (s executionSet) filterByDep(dep conf.Dependency) (executionSet, error) {
	var dependentExecutions executionSet

	executionsForModule := s.filterByModule(dep.Module)
	if len(executionsForModule) == 0 {
		return nil, fmt.Errorf("missing dependency: %v", dep.Module)
	}

	// If the dependency expression does not specific specific variables, then
	// assume it depends on any and all executions of this module.
	if dep.Variables == nil {
		return executionsForModule, nil
	}

	// Try to match the dependency to a specific execution.
	for _, e := range executionsForModule {
		if filterMaps(dep.Variables, e.Variables()) {
			dependentExecutions = append(dependentExecutions, e)
		}
	}

	// If there are no executions matching the dependency, it means the
	// configuration is wrong.
	if len(dependentExecutions) == 0 {
		return nil, fmt.Errorf("no execution matching dep: %v", dep)
	}

	return dependentExecutions, nil
}