diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c0ba2b1..b320b41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 0341d60..e84df9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ coverage.out coverage.out.html +CLAUDE.md diff --git a/init.go b/init.go index e71ec62..43df881 100644 --- a/init.go +++ b/init.go @@ -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{}, diff --git a/rules/helpers.go b/rules/helpers.go index 8dcd096..7593127 100644 --- a/rules/helpers.go +++ b/rules/helpers.go @@ -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() } diff --git a/validation.go b/validation.go index 46faac6..d20e922 100644 --- a/validation.go +++ b/validation.go @@ -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") }