Unverified Commit 0479f8ba authored by Bryan Liles's avatar Bryan Liles Committed by GitHub
Browse files

Merge pull request #526 from bryanl/param-set-semver

If param set float fails, use string
parents 958a6267 fd0bca08
......@@ -265,7 +265,11 @@ func DecodeValue(s string) (interface{}, error) {
case reInt.MatchString(s):
return strconv.Atoi(s)
case reFloat.MatchString(s):
return strconv.ParseFloat(s, 64)
fStr, err := strconv.ParseFloat(s, 64)
if err != nil {
return s, nil
}
return fStr, nil
case strings.ToLower(s) == "true" || strings.ToLower(s) == "false":
return strconv.ParseBool(s)
case reArray.MatchString(s):
......
......@@ -295,6 +295,11 @@ func TestDecodeValue(t *testing.T) {
},
},
},
{
name: "semantic version",
val: "0.0.1",
expected: "0.0.1",
},
{
name: "string",
val: "foo",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment