Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
validate
✓ github.com/gookit/validate
Validate a map with rules
package main
import (
"fmt"
"github.com/gookit/validate"
)
func main() {
v := validate.Map(map[string]interface{}{"name": "Alice", "age": 30})
v.StringRule("name", "required|minLen:2")
v.IntRule("age", "required|min:18")
if v.Validate() {
fmt.Println("Valid!")
} else {
fmt.Println(v.Errors)
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.6.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.