Re: [go-nuts] intentional fmt spacing behavior in for statement initializer ?

2018-02-19 Thread Ian Lance Taylor
On Mon, Feb 19, 2018 at 11:11 AM,   wrote:
> https://play.golang.org/p/Pvhg_npsg3Y
>
> (padded with spaces - press fmt for output)
>
>
> output :
>
> package main
>
>
> import "fmt"
>
>
> func main() {
>
> i, h, rs := 1, 1000, 160
>
>
> for y := i * (h / rs); y < (1+i)*(h/rs); y++ {
>
> fmt.Println(y)
>
> }
>
> }
>
>
>
> note the extra spaces in the initialiser of i, but no spaces in the
> condition
>
> the iterator also is padded with spaces if it contains brackets etc (not
> shown here)
>
> ...
>
> Is this an intentional readability thing, or just a bug ?

It's intentional.

Ian

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] intentional fmt spacing behavior in for statement initializer ?

2018-02-19 Thread xiofen77
https://play.golang.org/p/Pvhg_npsg3Y

(padded with spaces - press fmt for output)


output :

package main


import "fmt"


func main() {

i, h, rs := 1, 1000, 160


for y := i * (h / rs); y < (1+i)*(h/rs); y++ {

fmt.Println(y)

}

}



note the extra spaces in the initialiser of i, but no spaces in the 
condition

the iterator also is padded with spaces if it contains brackets etc (not 
shown here)

...

Is this an intentional readability thing, or just a bug ?

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.