Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code cleanup no functional changes #148

Merged
merged 2 commits into from
Aug 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (v *Validate) traverseField(topStruct reflect.Value, currentStruct reflect.
for _, t := range strings.Split(tag, tagSeparator) {

if t == diveTag {
tags = append(tags, &tagCache{tagVals: [][]string{[]string{t}}})
tags = append(tags, &tagCache{tagVals: [][]string{{t}}})
break
}

Expand Down
34 changes: 17 additions & 17 deletions validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,9 @@ func TestInterfaceErrValidation(t *testing.T) {

var errStructPtr2Array [][]*Inner

errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, nil})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, nil})

tmsp2 := &TestMultiDimensionalStructsPtr2{
Errs: errStructPtr2Array,
Expand Down Expand Up @@ -807,7 +807,7 @@ func TestMapDiveValidation(t *testing.T) {
Errs map[int]Inner `validate:"gt=0,dive"`
}

mi := map[int]Inner{0: Inner{"ok"}, 3: Inner{""}, 4: Inner{"ok"}}
mi := map[int]Inner{0: {"ok"}, 3: {""}, 4: {"ok"}}

ms := &TestMapStruct{
Errs: mi,
Expand Down Expand Up @@ -843,7 +843,7 @@ func TestMapDiveValidation(t *testing.T) {
Errs map[int]*Inner `validate:"gt=0,dive,required"`
}

mip := map[int]*Inner{0: &Inner{"ok"}, 3: nil, 4: &Inner{"ok"}}
mip := map[int]*Inner{0: {"ok"}, 3: nil, 4: {"ok"}}

msp := &TestMapStructPtr{
Errs: mip,
Expand All @@ -858,7 +858,7 @@ func TestMapDiveValidation(t *testing.T) {
Errs map[int]*Inner `validate:"gt=0,dive,omitempty,required"`
}

mip2 := map[int]*Inner{0: &Inner{"ok"}, 3: nil, 4: &Inner{"ok"}}
mip2 := map[int]*Inner{0: {"ok"}, 3: nil, 4: {"ok"}}

msp2 := &TestMapStructPtr2{
Errs: mip2,
Expand Down Expand Up @@ -945,8 +945,8 @@ func TestArrayDiveValidation(t *testing.T) {

var errStructArray [][]Inner

errStructArray = append(errStructArray, []Inner{Inner{"ok"}, Inner{""}, Inner{""}})
errStructArray = append(errStructArray, []Inner{Inner{"ok"}, Inner{""}, Inner{""}})
errStructArray = append(errStructArray, []Inner{{"ok"}, {""}, {""}})
errStructArray = append(errStructArray, []Inner{{"ok"}, {""}, {""}})

tms := &TestMultiDimensionalStructs{
Errs: errStructArray,
Expand All @@ -966,9 +966,9 @@ func TestArrayDiveValidation(t *testing.T) {

var errStructPtrArray [][]*Inner

errStructPtrArray = append(errStructPtrArray, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtrArray = append(errStructPtrArray, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtrArray = append(errStructPtrArray, []*Inner{&Inner{"ok"}, &Inner{""}, nil})
errStructPtrArray = append(errStructPtrArray, []*Inner{{"ok"}, {""}, {""}})
errStructPtrArray = append(errStructPtrArray, []*Inner{{"ok"}, {""}, {""}})
errStructPtrArray = append(errStructPtrArray, []*Inner{{"ok"}, {""}, nil})

tmsp := &TestMultiDimensionalStructsPtr{
Errs: errStructPtrArray,
Expand All @@ -991,9 +991,9 @@ func TestArrayDiveValidation(t *testing.T) {

var errStructPtr2Array [][]*Inner

errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{&Inner{"ok"}, &Inner{""}, nil})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr2Array = append(errStructPtr2Array, []*Inner{{"ok"}, {""}, nil})

tmsp2 := &TestMultiDimensionalStructsPtr2{
Errs: errStructPtr2Array,
Expand All @@ -1015,9 +1015,9 @@ func TestArrayDiveValidation(t *testing.T) {

var errStructPtr3Array [][]*Inner

errStructPtr3Array = append(errStructPtr3Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr3Array = append(errStructPtr3Array, []*Inner{&Inner{"ok"}, &Inner{""}, &Inner{""}})
errStructPtr3Array = append(errStructPtr3Array, []*Inner{&Inner{"ok"}, &Inner{""}, nil})
errStructPtr3Array = append(errStructPtr3Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr3Array = append(errStructPtr3Array, []*Inner{{"ok"}, {""}, {""}})
errStructPtr3Array = append(errStructPtr3Array, []*Inner{{"ok"}, {""}, nil})

tmsp3 := &TestMultiDimensionalStructsPtr3{
Errs: errStructPtr3Array,
Expand Down