easyjson
easyjson copied to clipboard
[]byte field is incorrectly generated as a string field, making it unmarshalable
Tested on this struct
type AvatarChangeInfo struct {
UserID uint64 `json:"-" valid:"-"`
Avatar []byte `json:"avatar" valid:"-"`
Filename string `json:"filename" valid:"-"`
Mimetype string `json:"mimetype" valid:"-"`
}
causing
parse error: expected string near offset 17 of 'avatar'
I'm also having this issue with a different struct with a []byte field.
I've tried generating the easyjson files with the -byte tag -- no effect.
I've tried generating the easyjson files with the nounsafe build tag (with easyjson -all -build_tags "easyjson_nounsafe" file.go, as vaguely described in the docs). which instead makes none of the generated methods be linked to the structs, rendering the easyjson marshaler/unmarshaler unusable entirely.