Re: [go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-15 Thread 'simon place' via golang-nuts
you could expose it to fmt, through String(), and keep it non-settable: https://play.golang.org/p/5wGsFY3Fpc -- 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 gol

Re: [go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-11 Thread sbkim via golang-nuts
On Friday, October 7, 2016 at 4:57:29 PM UTC-7, Ian Lance Taylor wrote: > > On Fri, Oct 7, 2016 at 4:18 PM, sbkim via golang-nuts > > wrote: > > > > If an operand of fmt.Printf implements method String() string, > fmt.Printf > > respects it and uses it. > > But it doesn't if an operand is a a

Re: [go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-07 Thread Ian Lance Taylor
On Fri, Oct 7, 2016 at 4:18 PM, sbkim via golang-nuts wrote: > > If an operand of fmt.Printf implements method String() string, fmt.Printf > respects it and uses it. > But it doesn't if an operand is a a struct that has such an element. > > For example, https://play.golang.org/p/QJC7Q9Kpch: > pack