Skip to content

Commit e735d05

Browse files
authored
Merge pull request confluentinc#7 from bruth/stringer
Replace stringable with fmt.Stringer
2 parents aa4daa2 + 2027caf commit e735d05

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

kafka/config.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,21 @@ func (m ConfigMap) Set(kv string) error {
7171
return m.SetKey(k, v)
7272
}
7373

74-
type stringable interface {
75-
String() string
76-
}
77-
7874
func value2string(v ConfigValue) (ret string, errstr string) {
7975

80-
switch v.(type) {
76+
switch x := v.(type) {
8177
case bool:
82-
if v.(bool) {
78+
if x {
8379
ret = "true"
8480
} else {
8581
ret = "false"
8682
}
8783
case int:
88-
ret = fmt.Sprintf("%d", v)
84+
ret = fmt.Sprintf("%d", x)
8985
case string:
90-
ret = v.(string)
91-
case stringable:
92-
ret = v.(stringable).String()
86+
ret = x
87+
case fmt.Stringer:
88+
ret = x.String()
9389
default:
9490
return "", fmt.Sprintf("Invalid value type %T", v)
9591
}

0 commit comments

Comments
 (0)