Revert gojson changes
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m34s

This commit is contained in:
2026-04-26 14:29:28 +02:00
parent d30e778bd4
commit 18c172d69a
6 changed files with 53 additions and 35 deletions
+8 -8
View File
@@ -108,11 +108,11 @@ func (u unmarshalerText) MarshalText() ([]byte, error) {
}
func (u *unmarshalerText) UnmarshalText(b []byte) error {
before, after, ok := bytes.Cut(b, []byte{':'})
if !ok {
pos := bytes.IndexByte(b, ':')
if pos == -1 {
return errors.New("missing separator")
}
u.A, u.B = string(before), string(after)
u.A, u.B = string(b[:pos]), string(b[pos+1:])
return nil
}
@@ -126,7 +126,7 @@ type ustructText struct {
type u8marshal uint8
func (u8 u8marshal) MarshalText() ([]byte, error) {
return fmt.Appendf(nil, "u%d", u8), nil
return []byte(fmt.Sprintf("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 fmt.Appendf(nil, `"Z%.2x"`, byte(b)), nil
return []byte(fmt.Sprintf(`"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 fmt.Appendf(nil, `Z%.2x`, byte(b)), nil
return []byte(fmt.Sprintf(`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 fmt.Appendf(nil, `"Z%.2x"`, int(b)), nil
return []byte(fmt.Sprintf(`"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 fmt.Appendf(nil, `Z%.2x`, int(b)), nil
return []byte(fmt.Sprintf(`Z%.2x`, int(b))), nil
}
func (b *intWithMarshalText) UnmarshalText(data []byte) error {