Repository navigation
Added support for validating private fields - #16
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for validating private (unexported) struct fields by introducing a new Interface function that works around Go's reflection limitations. The key change removes the ErrorOnPrivate flag and the associated ErrPrivateField error, allowing private fields with validation tags to be validated automatically.
- Adds
Interfacehelper function to extract values from private fields using reflection - Removes
ErrorOnPrivateconfiguration option andErrPrivateFielderror - Updates all validation checkers to use
Interfaceinstead of directreflect.Value.Interface()calls - Adds comprehensive test coverage for private field validation
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vali.go | Removes ErrorOnPrivate field, adds Interface function for private field access, removes private field error handling in validation logic |
| check.go | Updates all checker functions to use Interface helper, removes ErrPrivateField error, improves type handling in luhn and sizeCmp functions |
| vali_test.go | Adds extensive test cases for private field validation, adds TestInterface function to verify the Interface helper |
| example_test.go | Updates example to demonstrate private field validation instead of the removed ErrorOnPrivate feature |
| README.md | Updates documentation to reflect support for private field validation, removes ErrorOnPrivate examples |
| go.mod, tools/go.mod, tools/go.sum | Updates Go version to 1.25.4 and updates various tool dependencies |
| coverage-badge.svg | Adds coverage badge showing 97.4% test coverage |
| Makefile | Updates formatting commands and adds coverage badge generation |
| .golangci.yml | Configuration updates including line length increase and linter adjustments |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alexaandru
force-pushed
the
validate-private
branch
from
November 11, 2025 17:07
0cfff48 to
3f965ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.