Skip to content

go vet swears to json "required" tag #397

@k0st1a

Description

@k0st1a

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions