This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree Expand file treeCollapse file tree 2 files changed+10
-1
lines changedFilter options
+10
-1
lines changed Original file line number Diff line number Diff line change
@@ -265,7 +265,11 @@ func DecodeValue(s string) (interface{}, error) {
265
265
case reInt.MatchString(s):
266
266
return strconv.Atoi(s)
267
267
case reFloat.MatchString(s):
268
-
return strconv.ParseFloat(s, 64)
268
+
fStr, err := strconv.ParseFloat(s, 64)
269
+
if err != nil {
270
+
return s, nil
271
+
}
272
+
return fStr, nil
269
273
case strings.ToLower(s) == "true" || strings.ToLower(s) == "false":
270
274
return strconv.ParseBool(s)
271
275
case reArray.MatchString(s):
Original file line number Diff line number Diff line change
@@ -295,6 +295,11 @@ func TestDecodeValue(t *testing.T) {
295
295
},
296
296
},
297
297
},
298
+
{
299
+
name: "semantic version",
300
+
val: "0.0.1",
301
+
expected: "0.0.1",
302
+
},
298
303
{
299
304
name: "string",
300
305
val: "foo",
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4