• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-playground / validator / 15330172365
74%
v8: 100%

Build:
Build:
LAST BUILD BRANCH: master
DEFAULT BRANCH: v8
Ran 29 May 2025 05:56PM UTC
Jobs 1
Files 34
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 May 2025 05:56PM UTC coverage: 73.661% (+0.006%) from 73.655%
15330172365

push

github

web-flow
fix: panics when private field is validated (#1423)

## Fixes Or Enhances

`dive`, `omitnil` and time-related validations panic by themselves. 
panic inside panic happens for most of the checks in case of bad type.

`(reflect.Value).Interface()` can't be used if a field is private.
`getValue` must be used instead.
In case of casting to `string`, `fmt` is smart enough by itself.
In case of getting type with `%T`, `(reflect.Value).Type()` can be
safely used.
 

Without these changes tests fail with this error:

```
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method [recovered]
        panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

goroutine 22 [running]:
testing.tRunner.func1.2({0x10137e740, 0x101416580})
        /Users/yan/.go/src/testing/testing.go:1734 +0x1ac
testing.tRunner.func1()
        /Users/yan/.go/src/testing/testing.go:1737 +0x334
panic({0x10137e740?, 0x101416580?})
        /Users/yan/.go/src/runtime/panic.go:792 +0x124
reflect.valueInterface({0x10137e740?, 0x140002183a0?, 0x10141c850?}, 0xa0?)
        /Users/yan/.go/src/reflect/value.go:1495 +0xc8
reflect.Value.Interface(...)
        /Users/yan/.go/src/reflect/value.go:1484
github.com/go-playground/validator/v10.(*validate).traverseField(0x140001805a0, {0x10141a610, 0x1016cd0a0}, {0x1013ba060?, 0x1400008f550?, 0x17?}, {0x1013a7500?, 0x1400008f550?, 0x10137e980?}, {0x14000190340, ...}, ...)
        /Users/yan/projects/validator/validator.go:315 +0x222c
github.com/go-playground/validator/v10.(*validate).validateStruct(0x140001805a0, {0x10141a610, 0x1016cd0a0}, {0x101377bc0?, 0x1400008f550?, 0x101?}, {0x1013ba060?, 0x1400008f550?, 0x10137e980?}, {0x10141fd28, ...}, ...)
        /Users/yan/projects/validator/validator.go:72 +0x50c
github.com/go-playground/validator/v10.(*Validate).StructCtx(0x140000d03f0, {0x10141a610, 0x1016cd0a0}, {0x101377bc0, 0x1400008f550})
        /Users/yan/projects/validator/validat... (continued)

64 of 70 new or added lines in 4 files covered. (91.43%)

14313 of 19431 relevant lines covered (73.66%)

73.77 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
6
96.09
0.05% baked_in.go
Jobs
ID Job ID Ran Files Coverage
1 15330172365.1 29 May 2025 05:56PM UTC 34
73.66
GitHub Action Run
Source Files on build 15330172365
  • Tree
  • List 34
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 5b9542b9 on github
  • Prev Build on master (#15121002822)
  • Next Build on master (#15421773123)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc