From 22b73b0edc6e3c6f69a4e613c4bcca6eb75d29b2 Mon Sep 17 00:00:00 2001 From: XuShuo Date: Mon, 29 Jan 2024 19:29:19 +0800 Subject: [PATCH] feat: add fileName validation --- build.go | 3 +++ test.xlsx | Bin 6289 -> 6288 bytes 2 files changed, 3 insertions(+) diff --git a/build.go b/build.go index 325ce26..03ee3f2 100644 --- a/build.go +++ b/build.go @@ -56,6 +56,9 @@ type Option func(*options) // different sheetModel better have different sheet name to avoid confusion // rows ordered in Excel file is the same as sheetModels func WriteExcelSaveAs(fileName string, sheetModels []SheetModel, opts ...Option) error { + if fileName == "" { + return errors.New("fileName can not be empty") + } f, err := write(sheetModels, opts...) if err != nil { return err diff --git a/test.xlsx b/test.xlsx index 4b35eec94c026d9c76f3de50cc33aee505bc9960..5b2179e6cbc735f6dbdfba1d7e2fa254b418fd8a 100644 GIT binary patch delta 473 zcmbPeIKgm&+~x%w%NaNCV-;g!4Lt zHn;-hxHdI7LhQP1&5$lvP$pZz#&j-^aZW75oV%P7SzJu#91bjqYJSBLa{Q)l!^ey1 z!f*DghS&pr`2T-^H#^6&ttAo1C(H6GZayI($uzk^Oamx2d6k%|3?d{L7$g{w!4$^H zDPmfagCwN*J6RYQ;)_yqiuLtC0+U|@?YSi`rG8YHfuSNtzqq6_ bC$(6wA~z?%o0SdZCN3as0qXuH3gQ6(ZJC?6 delta 474 zcmbPWIMHzP1GeR?o7XYwGO=Fz;Vs2B`2q7>7REP40h1e9lr~DOX59QzK#-}Pzw%df zT}Z9D?uwWDvu~~OJNBzC=g%yj71tJ6FS1-l|R4+Q&Ny1y$^U=``b$Xht`lHjsL0VTE~(5(EuL&GuE%s=XmYl=;^ba2 jDb@2L3=Hu_sX4{^dLS~uo0SdZGA