diff --git a/gapr.go b/gapr.go index 18b2b11..550810c 100644 --- a/gapr.go +++ b/gapr.go @@ -133,7 +133,7 @@ func (g *Gapr) fieldMeta(f reflect.StructField) (drop bool, fieldName string, er } tagSplit := strings.Split(tagVal, ",") - if len(tagSplit) < 2 { + if len(tagSplit) < 1 { return false, f.Name, nil } @@ -143,7 +143,7 @@ func (g *Gapr) fieldMeta(f reflect.StructField) (drop bool, fieldName string, er } drop = g.rand.Float64() < dropProbability - if tagSplit[1] != "" { + if len(tagSplit) > 1 && tagSplit[1] != "" { fieldName = strings.TrimSpace(tagSplit[1]) }