The strings.Join function accepts only fragments of strings:
s := []string{"foo", "bar", "baz"} fmt.Println(strings.Join(s, ", "))
But it would be nice to be able to pass arbitrary objects that implement the ToString() function.
type ToStringConverter interface { ToString() string }
Is there something like this in Go, or do I need to decorate existing int types with ToString methods and write a wrapper around strings.Join ?
func Join(a []ToStringConverter, sep string) string
tostring go
deamon Nov 06 2018-12-12T00: 00Z
source share