Skip to content

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

@bqback

Description

@bqback

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions