sheriff
sheriff copied to clipboard
Cause bug when have struct method
Hi, I found a bug when a structure having method. For the example,
Find the User struct in sample code
type User struct {
Username string `json:"username" groups:"api"`
Email string `json:"email"`
Name string `json:"name" groups:"api"`
Roles []string `json:"roles" groups:"api"`
}
Add the following code below,
func (u User) String() string {
return fmt.Sprintf("User<%s %s>", u.Username, u.Name)
}
It will brick the scoping, marshal all the stuff into json.