Check checks that all files contain the required file header.
()
| 195 | |
| 196 | // Check checks that all files contain the required file header. |
| 197 | func (h Headers) Check() error { |
| 198 | mg.Deps(Headers.loadFile) |
| 199 | var checkErrs errorSlice |
| 200 | err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { |
| 201 | if info.IsDir() { |
| 202 | switch path { |
| 203 | case ".cache", ".dev", ".env", ".git", "dist", "node_modules", "public", "sdk/js/dist", "sdk/js/node_modules", "vendor": |
| 204 | return filepath.SkipDir |
| 205 | } |
| 206 | return nil |
| 207 | } |
| 208 | if selectedFiles != nil && !selectedFiles[path] { |
| 209 | return nil |
| 210 | } |
| 211 | if checkErr := h.check(path); checkErr != nil { |
| 212 | checkErrs = append(checkErrs, checkErr) |
| 213 | } |
| 214 | return nil |
| 215 | }) |
| 216 | if err != nil { |
| 217 | return err |
| 218 | } |
| 219 | if len(checkErrs) > 0 { |
| 220 | return checkErrs |
| 221 | } |
| 222 | return nil |
| 223 | } |
| 224 | |
| 225 | // CheckNewFiles checks that all new files contain the required file header with the correct year. |
| 226 | func (h Headers) CheckNewFiles() error { |