Compare commits

...

1 Commits
v1.0.4 ... main

Author SHA1 Message Date
AI Engineer
7c79333926 fix(convert): 修复由于 cast 库 API 变更导致的编译错误 (by AI) 2026-05-04 09:57:17 +08:00
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,10 @@
# Changelog: @go/convert # Changelog: @go/convert
## [v1.0.5] - 2026-05-04
### Fixed
- **兼容性修复**:修复了由于 `cast` 库 API 变更导致的 `MustJSONBytes` 未定义错误,更新为 `MustToJSONBytes`
## [v1.0.4] - 2026-04-30 ## [v1.0.4] - 2026-04-30
### Changed ### Changed

View File

@ -66,7 +66,7 @@ func performConversion(source, destination any) *reflect.Value {
if realDestination.CanAddr() { if realDestination.CanAddr() {
address := realDestination.Addr().Interface() address := realDestination.Addr().Interface()
if unmarshaler, isJSONUnmarshaler := address.(json.Unmarshaler); isJSONUnmarshaler { if unmarshaler, isJSONUnmarshaler := address.(json.Unmarshaler); isJSONUnmarshaler {
_ = unmarshaler.UnmarshalJSON(cast.MustJSONBytes(realSource.Interface())) _ = unmarshaler.UnmarshalJSON(cast.MustToJSONBytes(realSource.Interface()))
return nil return nil
} }
if unmarshaler, isYAMLUnmarshaler := address.(yaml.Unmarshaler); isYAMLUnmarshaler { if unmarshaler, isYAMLUnmarshaler := address.(yaml.Unmarshaler); isYAMLUnmarshaler {
@ -109,7 +109,7 @@ func performConversion(source, destination any) *reflect.Value {
case reflect.Slice: case reflect.Slice:
if destinationType.Elem().Kind() == reflect.Uint8 { 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 { } else {
normalizedSource := realSource normalizedSource := realSource
if sourceType.Kind() == reflect.String { if sourceType.Kind() == reflect.String {