How do you validate your structures?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • OPS - Build and Run Open Source Unikernels
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • 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.

    https://github.com/go-ozzo/ozzo-validation/blob/v3.6.0/struct.go#L61

  • validator

    I'm looking for a data validator and I don't like this approach where validation details are a part of tags: `validation:magic,42`. I've written my own validator but it's more like an example rather than complete implementation and it's not my particular task right now and I will be really happy to find something like that: ``go type User struct { Name stringjson:"name" Email stringjson:"email" Message stringjson:"message"` }

  • OPS

    OPS - Build and Run Open Source Unikernels. Quickly and easily build and deploy open source unikernels in tens of seconds. Deploy in any language to any cloud.

  • validator

    :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

    I like this https://github.com/go-playground/validator There are alot of predefined rule so I can validate simple struct without writing anycode. You can write your own custom validation functions as well.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts