Re: [go-nuts] Example of printing in go.dev

2022-03-09 Thread Kurtis Rader
On Wed, Mar 9, 2022 at 7:44 PM Nikhilesh Susarla wrote: > Okay. I get it. > When I ran through go playground I missed that type receiver was of > pointer type, so I was not sure why it didn't print as mentioned in the docs > It doesn't matter that the receiver "was of pointer type". That's just

Re: [go-nuts] Example of printing in go.dev

2022-03-09 Thread Nikhilesh Susarla
Okay. I get it. When I ran through go playground I missed that type receiver was of pointer type, so I was not sure why it didn't print as mentioned in the docs Thank you On Thursday, 10 March 2022 at 09:00:49 UTC+5:30 kortschak wrote: > On Wed, 2022-03-09 at 19:16 -0800, Nikhilesh Susarla wrot

Re: [go-nuts] Example of printing in go.dev

2022-03-09 Thread Kurtis Rader
On Wed, Mar 9, 2022 at 7:18 PM Nikhilesh Susarla wrote: > In https://go.dev/doc/effective_go#printing > I saw an example for printing our custom string output for the type. > The code below is from docs. > func (t *T) String() string { > return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c) > } > fmt

Re: [go-nuts] Example of printing in go.dev

2022-03-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2022-03-09 at 19:16 -0800, Nikhilesh Susarla wrote: > In https://go.dev/doc/effective_go#printing > I saw an example for printing our custom string output for the type. > The code below is from docs. > func (t *T) String() string { > return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c) > } > f

[go-nuts] Example of printing in go.dev

2022-03-09 Thread Nikhilesh Susarla
In https://go.dev/doc/effective_go#printing I saw an example for printing our custom string output for the type. The code below is from docs. func (t *T) String() string { return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c) } fmt.Printf("%v\n", t) But rather the statement should be this right? fm