(filePath string)
| 128 | } |
| 129 | |
| 130 | func LoadModuleConfig(filePath string) (ModuleConfig, error) { |
| 131 | config := ModuleConfig{} |
| 132 | |
| 133 | data, err := ioutil.ReadFile(filePath) |
| 134 | if err != nil { |
| 135 | return config, err |
| 136 | } |
| 137 | |
| 138 | err = yaml.Unmarshal(data, &config) |
| 139 | if err != nil { |
| 140 | return config, err |
| 141 | } |
| 142 | |
| 143 | missing := config.collectMissing() |
| 144 | if len(missing) > 0 { |
| 145 | flog.Errorf("%v is missing information", filePath) |
| 146 | |
| 147 | for _, m := range missing { |
| 148 | flog.Errorf("\t %v", m) |
| 149 | } |
| 150 | |
| 151 | log.Fatal("") |
| 152 | } |
| 153 | |
| 154 | if !ValidateZeroVersion(config) { |
| 155 | constraint := config.ZeroVersion.Constraints.String() |
| 156 | errTpl := `Module(%s) requires Zero to be version %s. Your current Zero version is: %s |
| 157 | Please update your Zero version to %s. |
| 158 | Please check %s for available releases.` |
| 159 | return config, errors.New(fmt.Sprintf(errTpl, config.Name, constraint, version.AppVersion, constraint, constants.ZeroReleaseURL)) |
| 160 | } |
| 161 | return config, nil |
| 162 | } |
| 163 | |
| 164 | // Recurses through a datastructure to find any missing data. |
| 165 | // This assumes several things: |
no test coverage detected