Description
Small package for validating postal codes. While the validation process does
not guarantee that the postcode actually exists, it does guarantee that the
format of the provided input is valid.
The reason for creating this package is that there is no good regular
expression for validating postal codes, and even if it existed, it would have
been huge and inefficient.
Full documentation can be found at: https://godoc.org/github.com/adrg/postcode
postcode alternatives and similar packages
Based on the "Validation" category.
Alternatively, view postcode alternatives based on common mentions on social networks and blogs.
-
validator
:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving -
ozzo-validation
An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags. -
Validate
⚔ Go package for data validation and filtering. support Map, Struct, Form data. Go通用的数据验证与过滤库,使用简单,内置大部分常用验证、过滤器,支持自定义验证器、自定义消息、字段翻译。
CodeRabbit: AI Code Reviews for Developers

Do you think we are missing an alternative of postcode or a related project?
README
postcode
Small package for validating postal codes. While the validation process does not guarantee that the postcode actually exists, it does guarantee that the format of the provided input is valid.
The reason for creating this package is that there is no good regular expression for validating postal codes, and even if it existed, it would have been huge and inefficient.
Full documentation can be found at: https://pkg.go.dev/github.com/adrg/postcode.
Installation
go get github.com/adrg/postcode
Usage
package main
import (
"github.com/adrg/postcode"
)
func main() {
if err := postcode.Validate("10007"); err != nil {
// Treat error.
}
}
References
For more information see
Contributing
Contributions in the form of pull requests, issues or just general feedback,
are always welcome.
See [CONTRIBUTING.MD](CONTRIBUTING.md).
License
Copyright (c) 2016 Adrian-George Bostan.
This project is licensed under the MIT license. See [LICENSE](LICENSE) for more details.
*Note that all licence references and agreements mentioned in the postcode README section above
are relevant to that project's source code only.