diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d4008e..dee1207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog: @go/convert +## [v1.0.5] - 2026-05-04 + +### Fixed +- **兼容性修复**:修复了由于 `cast` 库 API 变更导致的 `MustJSONBytes` 未定义错误,更新为 `MustToJSONBytes`。 + ## [v1.0.4] - 2026-04-30 ### Changed diff --git a/convert.go b/convert.go index 9e0e9ba..1e397b4 100644 --- a/convert.go +++ b/convert.go @@ -66,7 +66,7 @@ func performConversion(source, destination any) *reflect.Value { if realDestination.CanAddr() { address := realDestination.Addr().Interface() if unmarshaler, isJSONUnmarshaler := address.(json.Unmarshaler); isJSONUnmarshaler { - _ = unmarshaler.UnmarshalJSON(cast.MustJSONBytes(realSource.Interface())) + _ = unmarshaler.UnmarshalJSON(cast.MustToJSONBytes(realSource.Interface())) return nil } if unmarshaler, isYAMLUnmarshaler := address.(yaml.Unmarshaler); isYAMLUnmarshaler { @@ -109,7 +109,7 @@ func performConversion(source, destination any) *reflect.Value { case reflect.Slice: if destinationType.Elem().Kind() == reflect.Uint8 { - applyValue(realDestination, reflect.ValueOf(cast.MustJSONBytes(realSource.Interface())), &allocatedValue) + applyValue(realDestination, reflect.ValueOf(cast.MustToJSONBytes(realSource.Interface())), &allocatedValue) } else { normalizedSource := realSource if sourceType.Kind() == reflect.String {