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

2020-06-29 Thread Marvin Renich
[pedantic correction] * Marvin Renich [200629 14:10]: > The final argument to Printf is []interface{}, while you are trying to ^ ...interface{} ...Marvin -- You received this message because you are subscribed to the Google Gr

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

2020-06-29 Thread Marvin Renich
* yves baumes [200629 03:22]: > 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]...) > } > ```

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

2020-06-29 Thread Jan Mercl
On Mon, Jun 29, 2020 at 9:22 AM yves baumes wrote: > If I use append() instead of Printf(), this expanding of the host variables > just works out. Is this a compiler bug in the case of the fmt.Printf() ? No bug. That's how variable arguments and assignability rules are specified to work. -- Y

[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 secon