mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixed bug #11: Inability to set field to empty string
This commit is contained in:
parent
d07e436065
commit
cdd78af4bc
2
yaml.go
2
yaml.go
@ -195,7 +195,7 @@ func updateYaml(args []string) interface{} {
|
||||
|
||||
func parseValue(argument string) interface{} {
|
||||
var value, err interface{}
|
||||
var inQuotes = argument[0] == '"'
|
||||
var inQuotes = len(argument) > 0 && argument[0] == '"'
|
||||
if !inQuotes {
|
||||
value, err = strconv.ParseFloat(argument, 64)
|
||||
if err == nil {
|
||||
|
@ -14,6 +14,7 @@ var parseValueTests = []struct {
|
||||
{"\"true\"", "true", "boolean as string"},
|
||||
{"3.4", 3.4, "number"},
|
||||
{"\"3.4\"", "3.4", "number as string"},
|
||||
{"", "", "empty string"},
|
||||
}
|
||||
|
||||
func TestParseValue(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user