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

[]byte field is incorrectly generated as a string field, making it unmarshalable #392

Open
bqback opened this issue Dec 19, 2023 · 0 comments

Comments

@bqback
Copy link

bqback commented Dec 19, 2023

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.

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

1 participant