Skip to content

Pointers to structs generate wrong-looking (but correct) code #167

Open
@cespare

Description

@cespare

If I generate easyjson for something like

//easyjson:json
type T0 struct {
	P *T1
}

type T1 struct {
	S string
}

then the generated code includes this:

		switch key {
		case "P":
			if in.IsNull() {
				in.Skip()
				out.P = nil
			} else {
				if out.P == nil {
					out.P = new(T1)
				}
				easyjson89aae3efDecodeGithubComCespareX1(in, &*out.P)
			}

The &*out.P bit looks wrong and can be simplified to just out.P. This was caught by staticcheck.

There's no bug here, though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions