From f7b69fac7c41af2661e062436b00c2d5b7b012b2 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Mon, 13 May 2019 16:57:34 -0700 Subject: [PATCH] Extend ToStrs() to support ints or strings --- wtf/utils.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wtf/utils.go b/wtf/utils.go index 59c98f16..7334e073 100644 --- a/wtf/utils.go +++ b/wtf/utils.go @@ -6,6 +6,7 @@ import ( "os/exec" "regexp" "runtime" + "strconv" "strings" "github.com/wtfutil/wtf/utils" @@ -149,7 +150,12 @@ func ToStrs(slice []interface{}) []string { results := []string{} for _, val := range slice { - results = append(results, fmt.Sprintf("%v", val)) + switch val.(type) { + case int: + results = append(results, strconv.Itoa(val.(int))) + case string: + results = append(results, val.(string)) + } } return results