On Fri, Sep 1, 2017, at 10:00, Tong Sun wrote:
> For normal Go way, should I name the string function `*String*()` or `
> *ToString*()`?
If you want your type to satisfy the `fmt.Stringer' interface
(https://godoc.org/fmt#Stringer) the method should be named `String'.
—Sam
--
You received this
fmt.Sprint returns a string. You're not assigning it to a variable, so it's
"lost."
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@google
Hi,
What's wrong with my usage of `fmt.Sprint` in this code:
https://play.golang.org/p/ypzfUF_xXA
BTW,
For normal Go way, should I name the string function `*String*()` or `
*ToString*()`?
Thanks
--
You received this message because you are subscribed to the Google Groups
"golang-nuts"