See attachment.
I tried returning two closures from one function, but gofmt formats it
oddly.
It looks fine with a tab width of 4 (like go-tour), but it looks hideous
with
a tab width of 8.
Is this intentional? Does gofmt assume tab width of 4 or 8?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/06972172-40ea-4722-9013-6fafc1826abfn%40googlegroups.com.
package main
import (
"fmt"
)
func adder() (func(int) int, func(int) int) {
sum := 0
return func(x int) int {
sum += x
return sum
}, func(x int) int {
sum += x
return sum
}
}
func main() {
add1, add2 := adder()
for i := 0; i < 10; i++ {
fmt.Println(
add1(i),
add2(i),
)
}
}