On this page
Overview
go-playground/validator validates Go structs and fields through tags. It supports single-field rules, cross-field and cross-struct checks, slice, array, and map diving, key/value validation, custom types, alias tags, and internationalized validation errors.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Declare field and cross-field validation rules through struct tags
Built-in tags cover required values, ranges, network and string formats, while cross-field and cross-struct rules validate relationships between values.
Sources: [2]
Dive into collections and combine custom validators with translated errors
Nested slices and maps can be validated recursively, including map keys and values, alongside custom field types, alias tags, extracted field names, and locale-aware error translation.
Sources: [2]
Best fit
Fits Go backends that want shared validation for request DTOs and domain inputs
It is useful for API requests, configuration inputs, and command objects where repeated validation branches should be centralized. It is also the default validator used by Gin.
Sources: [2]
Before adoption
v10.30.5 requires Go 1.26 and required-struct behavior is expected to change by default in v11
The v10.30.5 go.mod declares Go 1.26, and the release adds Go 1.27 support while fixing signed integer fields in port validation. The README recommends WithRequiredStructEnabled, which is planned to become the default in v11+, so regression-test zero-value structs and nested validation before upgrading.
Official sources
- [1]go-playground/validator — GitHub repository(2026-10-06)
- [2]Validator v10.30.5 — README(2026-10-06)
- [3]Validator v10.30.5 — go.mod(2026-10-06)
- [4]Validator v10.30.5 release(2026-10-06)
- [5]Validator MIT license(2026-10-06)
Supplemental curator note
Validator centralizes request DTO and domain-input validation around tags and custom rules. Because required-struct behavior is expected to become the default in v11, new integrations should consider enabling WithRequiredStructEnabled now.
Try it in 3 steps
- 1
Get the source
git clone --depth 1 https://github.com/go-playground/validator.git - 2
Enter the repository
cd validator - 3
Check the official steps
Continue with the commands in the README Installation, Quick Start, or Getting Started section.
find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Growth
Growth trends · Last 30 days
20,194 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 12
- Open PRs
- 101
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- validation
- translation
- error-handling
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Fiber40,204 Stars
2 shared tag(s) · 1 shared category(s) · Same language
combine Express-inspired routing, binding, and middleware on top of fasthttp
Go - Echo32,754 Stars
2 shared tag(s) · 1 shared category(s) · Same language
A Go web framework that adds routing, middleware, binding, and error handling around net/http
Go - gRPC-Go23,092 Stars
2 shared tag(s) · 1 shared category(s) · Same language
implement typed Go service RPCs over HTTP/2 with the gRPC runtime
Go - Chi22,929 Stars
2 shared tag(s) · 1 shared category(s) · Same language
compose Go HTTP routes and middleware while keeping net/http compatibility
Go - Apache Casbin20,433 Stars
2 shared tag(s) · 1 shared category(s) · Same language
separate ACL, RBAC, and ABAC authorization policies from Go application code
Go - imgproxy11,109 Stars
2 shared tag(s) · 1 shared category(s) · Same language
offload application image processing to a standalone HTTP service
Go
Report incorrect information
Tell us if any listing information is incorrect or outdated.