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
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
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
Hello group,
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:
package main
import "fmt"
type Int int
func (i Int) String()