flatmap: never auto-convert ints
This commit is contained in:
parent
e2aeacc8d2
commit
308b88a8d8
|
@ -11,9 +11,7 @@ import (
|
|||
func Expand(m map[string]string, key string) interface{} {
|
||||
// If the key is exactly a key in the map, just return it
|
||||
if v, ok := m[key]; ok {
|
||||
if num, err := strconv.ParseInt(v, 0, 0); err == nil {
|
||||
return int(num)
|
||||
} else if v == "true" {
|
||||
if v == "true" {
|
||||
return true
|
||||
} else if v == "false" {
|
||||
return false
|
||||
|
|
|
@ -44,7 +44,7 @@ func TestExpand(t *testing.T) {
|
|||
Output: []interface{}{
|
||||
map[string]interface{}{
|
||||
"name": "bar",
|
||||
"port": 3000,
|
||||
"port": "3000",
|
||||
"enabled": true,
|
||||
},
|
||||
},
|
||||
|
@ -63,8 +63,8 @@ func TestExpand(t *testing.T) {
|
|||
map[string]interface{}{
|
||||
"name": "bar",
|
||||
"ports": []interface{}{
|
||||
1,
|
||||
2,
|
||||
"1",
|
||||
"2",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue