Skip to content

Struct field json:"xxx,omitempty" return nil when reference #173

Closed
@yisiper

Description

@yisiper

I am trying to get github user repositories
https://gist.github.com/yisiper/48ea8ddc9c48d97e7a9f

Not all repositories return it's language , the return json may just {language : null}, thus the pointer in struct point to nil.

it need to do many pointer nil checking before use those field.
Is it possible to let the default type initialized?
says string should be "", int should be 0.

ref: #19 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions