mvdan / gofumpt

A stricter gofmt
https://pkg.go.dev/mvdan.cc/gofumpt
BSD 3-Clause "New" or "Revised" License
3.15k stars 110 forks source link

Unnecessary newline in arguments when putting type parameters on a separate line #263

Open ainar-g opened 1 year ago

ainar-g commented 1 year ago
gofumpt --version
v0.4.1-0.20230125043819-8b5f734ef391 (go1.20.1)

Before:

package main

func f[
    T any,
](v T) (ok bool) {
    _ = v

    return true
}

func main() {
    _ = f(42)
}

After:

package main

func f[
    T any,
](v T,
) (ok bool) {
    _ = v

    return true
}

func main() {
    _ = f(42)
}

Notice how there is now a comma and a newline after v T. Go 1.20.1's gofmt does not add it. In my opinion, gofumpt should not add this newline.