Files
LearnGO/go/pkg/mod/mvdan.cc/gofumpt@v0.7.0/testdata/script/composite-multiline.txtar
T
2024-09-19 21:38:24 -04:00

128 lines
1.3 KiB
Plaintext

exec gofumpt -w foo.go
cmp foo.go foo.go.golden
exec gofumpt -d foo.go.golden
! stdout .
-- foo.go --
package p
var _ = []int{}
var _ = []int{
}
var _ = []int{1, 2,
3, 4}
var _ = []int{
1, 2, 3, 4}
var _ = [][]string{{
"no need for more newlines",
"if wrapping a single expression",
}}
var _ = []string{`
no need for newlines
`, `
if no elements are surrounded by newlines
`}
var _ = []struct{ a int }{
{ // consistent
a: 1,
},
{
a: 2,
}, { // inconsistent
a: 3,
},
}
var _ = []struct{ a int }{{
a: 1,
}, {
a: 2,
}, {
a: 3,
}}
var _ interface{
}
func _(struct{
})
var _ = []interface {
}{1, 2, 3}
func _(
)
type T struct {
Foo // comment
Bar struct { // comment
}
}
-- foo.go.golden --
package p
var _ = []int{}
var _ = []int{}
var _ = []int{
1, 2,
3, 4,
}
var _ = []int{
1, 2, 3, 4,
}
var _ = [][]string{{
"no need for more newlines",
"if wrapping a single expression",
}}
var _ = []string{`
no need for newlines
`, `
if no elements are surrounded by newlines
`}
var _ = []struct{ a int }{
{ // consistent
a: 1,
},
{
a: 2,
},
{ // inconsistent
a: 3,
},
}
var _ = []struct{ a int }{{
a: 1,
}, {
a: 2,
}, {
a: 3,
}}
var _ interface{}
func _(struct{})
var _ = []interface{}{1, 2, 3}
func _()
type T struct {
Foo // comment
Bar struct { // comment
}
}