Skip to content

Commit 308b88a

Browse files
committed
flatmap: never auto-convert ints
1 parent e2aeacc commit 308b88a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

flatmap/expand.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import (
1111
func Expand(m map[string]string, key string) interface{} {
1212
// If the key is exactly a key in the map, just return it
1313
if v, ok := m[key]; ok {
14-
if num, err := strconv.ParseInt(v, 0, 0); err == nil {
15-
return int(num)
16-
} else if v == "true" {
14+
if v == "true" {
1715
return true
1816
} else if v == "false" {
1917
return false

flatmap/expand_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestExpand(t *testing.T) {
4444
Output: []interface{}{
4545
map[string]interface{}{
4646
"name": "bar",
47-
"port": 3000,
47+
"port": "3000",
4848
"enabled": true,
4949
},
5050
},
@@ -63,8 +63,8 @@ func TestExpand(t *testing.T) {
6363
map[string]interface{}{
6464
"name": "bar",
6565
"ports": []interface{}{
66-
1,
67-
2,
66+
"1",
67+
"2",
6868
},
6969
},
7070
},

0 commit comments

Comments
 (0)