[go-nuts] Expanding variables and fmt.Printf() issue

2020-06-29 Thread yves baumes
Hello, considering this code ``` package main import ( "fmt" ) func main() { host := []string{"127", "0", "0", "1"} fmt.Printf("%v.%v.%v.%v\n", host[0], host[1], host[2], host[3]) fmt.Printf("%v.%v.%v.%v\n", host[0:4]...) } ``` The first Printf works and prints the host value. While the

Re: [go-nuts] Is there +v Stringer interface?

2020-06-25 Thread yves baumes
Thank you all :) Le jeu. 25 juin 2020 à 06:37, andrey mirtchovski a écrit : > >> fmt.Formatter is woefully under documented. > > > > My reference is pkg/errros - > https://github.com/pkg/errors/blob/master/errors.go#L127 > > we have wasted tens of man-hours hunting for a bug that didn't >

[go-nuts] Is there +v Stringer interface?

2020-06-24 Thread yves baumes
When I want to override the '%v' format, I declare a String() method. When I want to override the '%#v' format, I declare a GoString() method. But there is nothing about '%+v'? There is no PlusStringer() method ? Let's take the following exemple, the %v and %+v formatter prints the exact same