updated dependencies and go
This commit is contained in:
@@ -108,11 +108,11 @@ func (u unmarshalerText) MarshalText() ([]byte, error) {
|
||||
}
|
||||
|
||||
func (u *unmarshalerText) UnmarshalText(b []byte) error {
|
||||
pos := bytes.IndexByte(b, ':')
|
||||
if pos == -1 {
|
||||
before, after, ok := bytes.Cut(b, []byte{':'})
|
||||
if !ok {
|
||||
return errors.New("missing separator")
|
||||
}
|
||||
u.A, u.B = string(b[:pos]), string(b[pos+1:])
|
||||
u.A, u.B = string(before), string(after)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ type ustructText struct {
|
||||
type u8marshal uint8
|
||||
|
||||
func (u8 u8marshal) MarshalText() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf("u%d", u8)), nil
|
||||
return fmt.Appendf(nil, "u%d", u8), nil
|
||||
}
|
||||
|
||||
var errMissingU8Prefix = errors.New("missing 'u' prefix")
|
||||
@@ -275,7 +275,7 @@ func (unexportedWithMethods) F() {}
|
||||
type byteWithMarshalJSON byte
|
||||
|
||||
func (b byteWithMarshalJSON) MarshalJSON() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf(`"Z%.2x"`, byte(b))), nil
|
||||
return fmt.Appendf(nil, `"Z%.2x"`, byte(b)), nil
|
||||
}
|
||||
|
||||
func (b *byteWithMarshalJSON) UnmarshalJSON(data []byte) error {
|
||||
@@ -303,7 +303,7 @@ func (b *byteWithPtrMarshalJSON) UnmarshalJSON(data []byte) error {
|
||||
type byteWithMarshalText byte
|
||||
|
||||
func (b byteWithMarshalText) MarshalText() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf(`Z%.2x`, byte(b))), nil
|
||||
return fmt.Appendf(nil, `Z%.2x`, byte(b)), nil
|
||||
}
|
||||
|
||||
func (b *byteWithMarshalText) UnmarshalText(data []byte) error {
|
||||
@@ -331,7 +331,7 @@ func (b *byteWithPtrMarshalText) UnmarshalText(data []byte) error {
|
||||
type intWithMarshalJSON int
|
||||
|
||||
func (b intWithMarshalJSON) MarshalJSON() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf(`"Z%.2x"`, int(b))), nil
|
||||
return fmt.Appendf(nil, `"Z%.2x"`, int(b)), nil
|
||||
}
|
||||
|
||||
func (b *intWithMarshalJSON) UnmarshalJSON(data []byte) error {
|
||||
@@ -359,7 +359,7 @@ func (b *intWithPtrMarshalJSON) UnmarshalJSON(data []byte) error {
|
||||
type intWithMarshalText int
|
||||
|
||||
func (b intWithMarshalText) MarshalText() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf(`Z%.2x`, int(b))), nil
|
||||
return fmt.Appendf(nil, `Z%.2x`, int(b)), nil
|
||||
}
|
||||
|
||||
func (b *intWithMarshalText) UnmarshalText(data []byte) error {
|
||||
|
||||
Reference in New Issue
Block a user