MCPcopy Create free account
hub / github.com/commander-cli/commander / readFile

Function readFile

pkg/app/test_command.go:198–214  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

196}
197
198func 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}

Callers 1

getSuiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected