diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-10-28 11:16:56 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-08 12:44:06 +0100 |
| commit | 02477b25264659f10889ce84e57a6603d9d613a2 (patch) | |
| tree | cc0919e9e81c4993f4d4fe96e99127f2a1d557c4 | |
| parent | e094de58746e2d982b6a23e28c5db2870b45d43d (diff) | |
eprintf
| -rw-r--r-- | core/encoding/csv/doc.odin | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/encoding/csv/doc.odin b/core/encoding/csv/doc.odin index 58e2a7ac5..c6dae3005 100644 --- a/core/encoding/csv/doc.odin +++ b/core/encoding/csv/doc.odin @@ -22,7 +22,7 @@ Example: if csv_err == nil { csv.reader_init_with_string(&r, string(csv_data)) } else { - fmt.printfln("Unable to open file: %v. Error: %v", filename, csv_err) + fmt.eprintfln("Unable to open file: %v. Error: %v", filename, csv_err) return } @@ -46,7 +46,7 @@ Example: handle, err := os.open(filename) defer os.close(handle) if err != nil { - fmt.eprintfln("Error %v opening file: %v", err, filename) + fmt.eprintfln("Unable to open file: %v. Error: %v", filename, err) return } csv.reader_init(&r, handle.stream) @@ -67,12 +67,11 @@ Example: csv_data, csv_err := os.read_entire_file(filename, context.allocator) defer delete(csv_data, context.allocator) - if csv_err == nil { - csv.reader_init_with_string(&r, string(csv_data)) - } else { - fmt.printfln("Unable to open file: %v. Error: %v", filename, csv_err) + if err != nil { + fmt.eprintfln("Unable to open file: %v. Error: %v", filename, csv_err) return } + csv.reader_init_with_string(&r, string(csv_data)) records, err := csv.read_all(&r) if err != nil { /* Do something with CSV parse error */ } |