File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -83,15 +83,15 @@ func (t Term) build() (interface{}, error) {
8383 }
8484 }
8585
86- args := []interface {}{}
87- optArgs := map [string ]interface {}{}
86+ args := make ( []interface {}, len ( t . args ))
87+ optArgs := make ( map [string ]interface {}, len ( t . optArgs ))
8888
89- for _ , v := range t .args {
89+ for i , v := range t .args {
9090 arg , err := v .build ()
9191 if err != nil {
9292 return nil , err
9393 }
94- args = append ( args , arg )
94+ args [ i ] = arg
9595 }
9696
9797 for k , v := range t .optArgs {
Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ func optArgsToMap(optArgs OptArgs) map[string]interface{} {
173173
174174// Convert a list into a slice of terms
175175func convertTermList (l []interface {}) termsList {
176+ if len (l ) == 0 {
177+ return nil
178+ }
179+
176180 terms := make (termsList , len (l ))
177181 for i , v := range l {
178182 terms [i ] = Expr (v )
@@ -183,6 +187,10 @@ func convertTermList(l []interface{}) termsList {
183187
184188// Convert a map into a map of terms
185189func convertTermObj (o map [string ]interface {}) termsObj {
190+ if len (o ) == 0 {
191+ return nil
192+ }
193+
186194 terms := make (termsObj , len (o ))
187195 for k , v := range o {
188196 terms [k ] = Expr (v )
You can’t perform that action at this time.
0 commit comments