Skip to content

Commit

Permalink
util/assert: ExactlyLength recursive behaviour
Browse files Browse the repository at this point in the history
if a struct contains other structs or pointers
  • Loading branch information
SchumacherFM committed Dec 5, 2018
1 parent 5f0a5b3 commit 3321e5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions util/assert/assertions.go
Expand Up @@ -335,6 +335,12 @@ func shortenStrings(maxLength int, val reflect.Value) {
s := f.String()[:maxLength]
f.SetString(s)
}
case reflect.Ptr:
v := f.Elem()
shortenStrings(maxLength, v)

case reflect.Struct:
shortenStrings(maxLength, f.Elem())
}
}
}
Expand Down

0 comments on commit 3321e5b

Please sign in to comment.