fix(convert): 修复由于 cast 库 API 变更导致的编译错误 (by AI)
This commit is contained in:
parent
655ce6c716
commit
7c79333926
@ -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
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user