| 85 | } |
| 86 | |
| 87 | func testDir(directory string, filters runtime.Filters) (runtime.Result, error) { |
| 88 | result := runtime.Result{} |
| 89 | files, err := ioutil.ReadDir(directory) |
| 90 | if err != nil { |
| 91 | return result, fmt.Errorf("Error: Input is not a directory") |
| 92 | } |
| 93 | |
| 94 | for _, f := range files { |
| 95 | if f.IsDir() { |
| 96 | continue // skip dirs |
| 97 | } |
| 98 | |
| 99 | p := path.Join(directory, f.Name()) |
| 100 | newResult, err := testFile(p, f.Name(), filters) |
| 101 | if err != nil { |
| 102 | return result, err |
| 103 | } |
| 104 | |
| 105 | result = convergeResults(result, newResult) |
| 106 | } |
| 107 | |
| 108 | return result, nil |
| 109 | } |
| 110 | |
| 111 | func testURL(url string, filters runtime.Filters) (runtime.Result, error) { |
| 112 | resp, err := http.Get(url) |