Skip to content

Commit

Permalink
ReadFile() now returns the actual error (if any) returned by os.Open(…
Browse files Browse the repository at this point in the history
…) so that the client can inspect the error (e.g. via os.IsNotExist()) to determine if the file doesn't exist.
  • Loading branch information
cet001 committed Mar 20, 2018
1 parent 6c1bb55 commit abe3257
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hastycsv.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (me *Reader) Read(r io.Reader, nextRecord func(i int, record []Field)) erro
func ReadFile(csvFilePath string, delim byte, nextRecord func(i int, record []Field)) error {
f, err := os.Open(csvFilePath)
if err != nil {
return fmt.Errorf("Error opening '%v': %v", csvFilePath, err)
return err
}
defer f.Close()

Expand Down

0 comments on commit abe3257

Please sign in to comment.