easyjson icon indicating copy to clipboard operation
easyjson copied to clipboard

go vet swears to json "required" tag

Open k0st1a opened this issue 1 year ago • 0 comments

There is a code:

type Register struct {
	Login       string `json:"login,required"`
}

After execute go vet -vettool=$$(which statictest) ./... appears error unknown JSON option "required"

May be added additional tag for this? For example:

type Register struct {
	Login       string `json:"login" easyjson:"required"`
}

Or use https://github.com/go-playground/validator ? Example:

type Register struct {
	Login       string `json:"login" validate:"required"`
}

P.S. In https://github.com/thriftrw/thriftrw-go/blob/dev/Makefile i found solution - filter errors from go vet.

k0st1a avatar Apr 19 '24 17:04 k0st1a