Hi,
I noticed today that gofmt (on the Playground at least) reformats /* */ comments that are inlined in argument lists inconsistently and in a non-faithful manner to their original ordering in the list:
Pre-Gofmt
fmt.Println(/* before first */ "first", /* before second */ "second")
demo
Post-Gofmt
fmt.Println( /* before first */ "first" /* before second */, "second")
demo
Notice how in the Post-Gofmt case it moves the comment that occurred after the comma to before.
This behavior is incongruent to what happens when the argument lists are spread across multiple lines:
Newline Distributed Pre-Gofmt
package main
import "fmt"
func main() {
fmt.Println(
/* before first */ "first")
fmt.Println(
/* before first */ "first",
/* before second */ "second")
}
demo
Newline Distributed Post-Gofmt
package main
import "fmt"
func main() {
fmt.Println(
/* before first */ "first")
fmt.Println(
/* before first */ "first",
/* before second */ "second")
}
demo
For the pre cases, be sure to click Format in the Go Playground demo to see the post-state.
Hi,
I noticed today that gofmt (on the Playground at least) reformats
/* */comments that are inlined in argument lists inconsistently and in a non-faithful manner to their original ordering in the list:Pre-Gofmt
fmt.Println(/* before first */ "first", /* before second */ "second")demo
Post-Gofmt
fmt.Println( /* before first */ "first" /* before second */, "second")demo
Notice how in the Post-Gofmt case it moves the comment that occurred after the comma to before.
This behavior is incongruent to what happens when the argument lists are spread across multiple lines:
Newline Distributed Pre-Gofmt
demo
Newline Distributed Post-Gofmt
demo
For the pre cases, be sure to click
Formatin the Go Playground demo to see the post-state.