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

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

Open
cespare opened this issue Feb 23, 2018 · 0 comments
Open

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

cespare opened this issue Feb 23, 2018 · 0 comments

Comments

@cespare
Copy link
Contributor

cespare commented Feb 23, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants