-
-
Notifications
You must be signed in to change notification settings - Fork 152
Description
Describe the bug
When I try to put "string" value while the string happens is a valid int for Go, the int is put in the document.
This is not expected, because, one cannot add a string (singe character) like this: '0'.
To Reproduce
echo 't:' | dasel put -r yaml -t string -v "0x12_11" -s 't' | dasel -r yaml 't.type()'
number
Since the string is provided, I have expected string on output, not int.
Same for bool:
echo 't:' | dasel put -r yaml -t string -v "true" -s 't' | dasel -r yaml 't.type()'
bool
As a bonus two panics:
echo '' | dasel put -r yaml -t string -v "0x12_11" -s 't'
panic: reflect: call of reflect.Value.Set on zero Value
echo 't:' | dasel put -r yaml -t string -v "0x12_11" -s ''
panic: reflect: reflect.Value.Set using unaddressable value
Expected behavior
Add string to a document as requested by user.
Add value to an empty document on first panic.
Do not panic on second panic.
Desktop (please complete the following information):
- Windows 11
- dasel version v2.3.3