Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '^1.24'
- name: golangci-lint
Expand All @@ -23,7 +23,7 @@ jobs:
needs: lint
strategy:
matrix:
go: ["1.18", "1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
go: ["1.18", "1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25", "1.26"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage.out
coverage.out.html
CLAUDE.md
1 change: 1 addition & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func registerDefaultRules() {
"dateTimeAfter": &rules.DateTimeAfter{},
"dateTimeBefore": &rules.DateTimeBefore{},
"dateTimeBetween": &rules.DateTimeBetween{},
"dateTimeFormat": &rules.DateTimeFormat{},
"different": &rules.Different{},
"digits": &rules.Digits{},
"digitsBetween": &rules.DigitsBetween{},
Expand Down
4 changes: 2 additions & 2 deletions rules/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import "reflect"

func indirectValue(a any) reflect.Value {
v := reflect.ValueOf(a)
if v.Kind() != reflect.Ptr {
if v.Kind() != reflect.Pointer {
return v
}

for v.Kind() == reflect.Ptr && !v.IsNil() {
for v.Kind() == reflect.Pointer && !v.IsNil() {
v = v.Elem()
}

Expand Down
2 changes: 1 addition & 1 deletion validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func ValidateStruct(input any, rulesMap RulesMap, locale ...string) Result {
}

v := reflect.ValueOf(input)
if v.Kind() != reflect.Struct && (v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct) {
if v.Kind() != reflect.Struct && (v.Kind() != reflect.Pointer || v.Elem().Kind() != reflect.Struct) {
panic("validation.ValidateStruct only support struct or a pointer to a struct as first parameter")
}

Expand Down
Loading