Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to verify that the string is empty? Use length to judge? #395

Closed
rookiefront opened this issue Aug 8, 2020 · 2 comments
Closed

How to verify that the string is empty? Use length to judge? #395

rookiefront opened this issue Aug 8, 2020 · 2 comments

Comments

@rookiefront
Copy link

package main

import (
	"fmt"
	"github.com/asaskevich/govalidator"
)

type T struct {
	Title  string `json:"title" valid:"required"`
	Content string `json:"content" `
	Text string `json:"text" valid:"required"`
}


func main() {
	_f := T{
		Title:   "",
		Content: "",
		Text:    "",
	}

	_, err := govalidator.ValidateStruct(_f)
	fmt.Println(err)
	// IS nil
}

How to verify that the string is empty? Use length to judge?

@migueleliasweb
Copy link

I'm having the same problem. What was the solution for this? @codexuexi

@migueleliasweb
Copy link

Might be related to: #359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants