Skip to content

code generated for map[string]interface{} could be simplified #417

Description

@orian

https://github.com/PostHog/posthog/pull/31752/files/477c24428b8892ff6b053b75273dbe33be0524b9#r2068284723

Actual:

var v1 interface{}
if m, ok := v1.(easyjson.Unmarshaler); ok {
	m.UnmarshalEasyJSON(in)
} else if m, ok := v1.(json.Unmarshaler); ok {
	_ = m.UnmarshalJSON(in.Raw())
} else {
	v1 = in.Interface()
}

Could be:

v1 := in.Interface()
if m, ok := v1.(easyjson.Unmarshaler); ok {
	m.UnmarshalEasyJSON(in)
} else if m, ok := v1.(json.Unmarshaler); ok {
	_ = m.UnmarshalJSON(in.Raw())
}
(out.Properties)[key] = v1
in.WantComma()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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