diff --git a/internal/convert/converter.go b/internal/convert/converter.go index 0b0af117..b76bd0cf 100644 --- a/internal/convert/converter.go +++ b/internal/convert/converter.go @@ -415,8 +415,7 @@ func (c Converter) convertSlice(name string, fromVal, toVal reflect.Value) error return errors.Join(errs...) case fromVal.Kind() == reflect.String && toVal.Type().Elem().Kind() == reflect.Uint8: - s := fromVal.String() - toVal.SetBytes(internal.String2ByteSlice(s)) + toVal.SetBytes(internal.String2ByteSlice(fromVal.String())) case fromVal.Kind() == reflect.Map: // Empty maps turn into empty arrays if fromVal.Len() == 0 { @@ -459,8 +458,7 @@ func (c Converter) convertString(name string, fromVal, toVal reflect.Value) erro reflect.Copy(reflect.ValueOf(bytes), fromVal) toVal.SetString(internal.ByteSlice2String(bytes)) case fromVal.Kind() == reflect.Slice && fromVal.Type().Elem().Kind() == reflect.Uint8: - bytes := fromVal.Bytes() - toVal.SetString(internal.ByteSlice2String(bytes)) + toVal.SetString(internal.ByteSlice2String(fromVal.Bytes())) default: return fmt.Errorf( //nolint:goerr113 "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",