diff --git a/postgres/ynab-export.go b/postgres/ynab-export.go index 0443929..95e5290 100644 --- a/postgres/ynab-export.go +++ b/postgres/ynab-export.go @@ -47,7 +47,10 @@ func (ynab *YNABExport) ExportAssignments(context context.Context, w io.Writer) "0,00€", } - csv.Write(row) + err := csv.Write(row) + if err != nil { + return fmt.Errorf("write assignment: %w", err) + } count++ } csv.Flush() @@ -59,7 +62,7 @@ func (ynab *YNABExport) ExportAssignments(context context.Context, w io.Writer) // ImportTransactions expects a TSV-file as exported by YNAB in the following format: // "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared" -// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared" +// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared". func (ynab *YNABExport) ExportTransactions(context context.Context, w io.Writer) error { csv := csv.NewWriter(w) csv.Comma = '\t' @@ -90,7 +93,10 @@ func (ynab *YNABExport) ExportTransactions(context context.Context, w io.Writer) row = append(row, string(transaction.Status)) - csv.Write(row) + err := csv.Write(row) + if err != nil { + return fmt.Errorf("write transaction: %w", err) + } count++ } diff --git a/postgres/ynab-import.go b/postgres/ynab-import.go index fd5f173..f54d092 100644 --- a/postgres/ynab-import.go +++ b/postgres/ynab-import.go @@ -118,7 +118,7 @@ type Transfer struct { // ImportTransactions expects a TSV-file as exported by YNAB in the following format: // "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared" -// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared" +// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared". func (ynab *YNABImport) ImportTransactions(context context.Context, r io.Reader) error { csv := csv.NewReader(r) csv.Comma = '\t'