title: Return custom error message from struct tag validation
body: <p>I'm using Go 1.17 with Gin and I want to implement a struct validation before sending the data to my database. I took the example from <a href="https://gin-gonic.com/docs/examples/custom-validators/" rel="nofollow noreferrer">Gin documentation</a>.</p>
  <p>In the struct we can declare different tags to validate a field like this:</p>
  <pre><code>type User struct {
      FirstName      string `json:&quot;first_name&quot; binding:&quot;required&quot;`
      LastName       string `json:&quot;last_name&quot; binding:&quot;required&quot;`
      Age            uint8  `json:&quot;age&quot; binding:&quot;gte=0,lte=130&quot;`
      Email          string `json:&quot;email&quot; binding:&quot;required,email&quot;`
      FavouriteColor string `json:&quot;favourite_color&quot; binding:&quot;iscolor&quot;`
  }
  </code></pre>
  <p>And in the handler I can grab the error like this:</p>
  <pre><code>var u User
  if err := c.ShouldBindWith(&amp;u, binding.Query); err == nil {
      c.JSON(http.StatusOK, gin.H{&quot;message&quot;: &quot;Good Job&quot;})
  } else {
      c.JSON(http.StatusBadRequest, gin.H{&quot;error&quot;: err.Error()})
  }
  </code></pre>
  <p>The error message will be:</p>
  <pre><code>{
      &quot;error&quot;: &quot;Key: 'User.FirstName' Error:Field validation for 'FirstName' failed on the 'required' tag\nKey: 'User.LastName' Error:Field validation for 'LastName' failed on the 'required' tag\nKey: 'User.Email' Error:Field validation for 'Email' failed on the 'required' tag\nKey: 'User.FavouriteColor' Error:Field validation for 'FavouriteColor' failed on the 'iscolor' tag&quot;
  }
  </code></pre>
  <p>The error messages are too verbose how it's possible to returns a better error to the user? I'd like to model the json response like:</p>
  <pre><code>{
      &quot;errors&quot;: [
          &quot;first_name&quot;: &quot;This field is required&quot;,
          &quot;last_name&quot;: &quot;This field is required&quot;,
          &quot;age&quot;: &quot;This field is required&quot;,
          &quot;email&quot;: &quot;Invalid email&quot;
      ]
  }
  </code></pre>