瀏覽代碼

Get latest revision "github.com/fatih/structs"

xormplus 7 年之前
父節點
當前提交
cf59c0c76a
共有 2 個文件被更改,包括 3 次插入5 次删除
  1. 2 4
      vendor/github.com/fatih/structs/structs.go
  2. 1 1
      vendor/github.com/fatih/structs/tags.go

+ 2 - 4
vendor/github.com/fatih/structs/structs.go

@@ -203,9 +203,7 @@ func (s *Struct) Values() []interface{} {
 		if IsStruct(val.Interface()) && !tagOpts.Has("omitnested") {
 			// look out for embedded structs, and convert them to a
 			// []interface{} to be added to the final values slice
-			for _, embeddedVal := range Values(val.Interface()) {
-				t = append(t, embeddedVal)
-			}
+			t = append(t, Values(val.Interface())...)
 		} else {
 			t = append(t, val.Interface())
 		}
@@ -573,7 +571,7 @@ func (s *Struct) nested(val reflect.Value) interface{} {
 			break
 		}
 
-		slices := make([]interface{}, val.Len(), val.Len())
+		slices := make([]interface{}, val.Len())
 		for x := 0; x < val.Len(); x++ {
 			slices[x] = s.nested(val.Index(x))
 		}

+ 1 - 1
vendor/github.com/fatih/structs/tags.go

@@ -5,7 +5,7 @@ import "strings"
 // tagOptions contains a slice of tag options
 type tagOptions []string
 
-// Has returns true if the given optiton is available in tagOptions
+// Has returns true if the given option is available in tagOptions
 func (t tagOptions) Has(opt string) bool {
 	for _, tagOpt := range t {
 		if tagOpt == opt {