types/model: remove MarshalText/UnmarshalText from Digest (#3586)

This commit is contained in:
Blake Mizerany 2024-04-10 16:52:49 -07:00 committed by GitHub
parent 6a1de23175
commit 62f8cda3b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,20 +38,6 @@ func (d Digest) String() string { return d.s }
// ParseName(name).Digest(). // ParseName(name).Digest().
func (d Digest) IsValid() bool { return d.s != "" } func (d Digest) IsValid() bool { return d.s != "" }
// MarshalText implements encoding.TextMarshaler.
func (d Digest) MarshalText() ([]byte, error) {
return []byte(d.String()), nil
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (d *Digest) UnmarshalText(text []byte) error {
if d.IsValid() {
return errors.New("model.Digest: illegal UnmarshalText on valid Digest")
}
*d = ParseDigest(string(text))
return nil
}
// LogValue implements slog.Value. // LogValue implements slog.Value.
func (d Digest) LogValue() slog.Value { func (d Digest) LogValue() slog.Value {
return slog.StringValue(d.String()) return slog.StringValue(d.String())