(filePath string)
| 196 | } |
| 197 | |
| 198 | func readFile(filePath string) ([]byte, error) { |
| 199 | f, err := os.Stat(filePath) |
| 200 | if err != nil { |
| 201 | return nil, fmt.Errorf("open %s: no such file or directory", filePath) |
| 202 | } |
| 203 | |
| 204 | if f.IsDir() { |
| 205 | return nil, fmt.Errorf("%s: is a directory\nUse --dir to test directories with multiple test files", filePath) |
| 206 | } |
| 207 | |
| 208 | content, err := ioutil.ReadFile(filePath) |
| 209 | if err != nil { |
| 210 | return nil, err |
| 211 | } |
| 212 | |
| 213 | return content, nil |
| 214 | } |