From 5ca7231ed408ac264f509ff52b5d28ff4fbda757 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 3 Jan 2020 23:57:25 +0800 Subject: optimize code and comments: use println errors instead of panic --- rows.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'rows.go') diff --git a/rows.go b/rows.go index d24b1a6..40972ae 100644 --- a/rows.go +++ b/rows.go @@ -63,7 +63,6 @@ type Rows struct { err error curRow, totalRow, stashRow int sheet string - stashColumn []string rows []xlsxRow f *File decoder *xml.Decoder @@ -111,7 +110,6 @@ func (rows *Rows) Columns() ([]string, error) { } if row > rows.curRow { rows.stashRow = row - 1 - rows.stashColumn = columns return columns, err } } @@ -153,12 +151,19 @@ func (err ErrSheetNotExist) Error() string { // Rows return a rows iterator. For example: // // rows, err := f.Rows("Sheet1") +// if err != nil { +// println(err.Error()) +// return +// } // for rows.Next() { // row, err := rows.Columns() +// if err != nil { +// println(err.Error()) +// } // for _, colCell := range row { -// fmt.Print(colCell, "\t") +// print(colCell, "\t") // } -// fmt.Println() +// println() // } // func (f *File) Rows(sheet string) (*Rows, error) { -- cgit v1.2.1