google / uuid

Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MarshalBinary() error return value redundant

MrWaggel opened this issue · comments

err is always nil, is there any reason behind it? I know it probably won't be fixed to avoid breaking changes. But doesn't this cause unneeded overhead, or is the compiler smart enough to ignore this?

// MarshalBinary implements encoding.BinaryMarshaler.
func (uuid UUID) MarshalBinary() ([]byte, error) {
	return uuid[:], nil
}

return uuid[:], nil

This is satisfying the encoding.BinaryMarshaler interface so it must return the nil.