Go Model Code Formatting Agreement: " gofmtis an agreement." There is one part of this agreement that is hard for me to understand, and it would be great to have a formal definition of what gofmtis implementation, rather than the need to derive a model from empirical examples. Here is a sample.
To go fmt:
func sieve(mine int,
inch chan int,
done chan int,
count int) {
start := true
ouch := make(chan int)
fmt.Printf("%v ", mine)
After go fmt:
func sieve(mine int,
inch chan int,
done chan int,
count int) {
start := true
ouch := make(chan int)
fmt.Printf("%v ", mine)
Can someone help me understand what is going on here? This is why some comments were compressed to the detriment, while others were expanded? Some theories:
- It's so ugly that it should mean that code without comments on one line is preferable
- There is a mistake in
gofmt - Incomplete (in some way) lines are processed differently than full
- Something else?