Skip to content

net/url: Userinfo should support encoding/gob #10964

@chowey

Description

@chowey

Currently the encoding/gob package does not support embedded structs with no exported fields. See #5819.

This is problematic for the net/url package. I cannot serialize a url.URL into a gob because url.Userinfo has no exported fields. I can't be the only one who has needed to serialize a struct with a URL in it.

This is solvable without modification to the encoding/gob if we fix url.Userinfo. This is possible by implementing encoding.BinaryMarshaler and encoding.BinaryUnmarshaler:

func (u *Userinfo) UnmarshalBinary(data []byte) error {
    return nil
}

func (u *Userinfo) MarshalBinary() (data []byte, err error) {
    return nil, nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions