whatcanGOwrong
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Explicitly given generated files are formatted with our rules.
|
||||
exec gofumpt foo.go
|
||||
cmp stdout foo.go.golden
|
||||
|
||||
# stdin is still considered an explicit file.
|
||||
stdin foo.go
|
||||
exec gofumpt
|
||||
cmp stdout foo.go.golden
|
||||
|
||||
# Implicitly walked generated files get formatted without the added rules.
|
||||
exec gofumpt -l .
|
||||
stdout -count=1 '^badgofmt.go$'
|
||||
! stdout '^foo.go$'
|
||||
! stderr .
|
||||
|
||||
-- badgofmt.go --
|
||||
// Code generated by foo. DO NOT EDIT.
|
||||
|
||||
package foo
|
||||
|
||||
func f() {
|
||||
println("body")
|
||||
}
|
||||
-- foo.go --
|
||||
// foo is a package about bar.
|
||||
|
||||
// Code generated by foo. DO NOT EDIT.
|
||||
|
||||
package foo
|
||||
|
||||
func f() {
|
||||
|
||||
println("body")
|
||||
|
||||
}
|
||||
-- foo.go.golden --
|
||||
// foo is a package about bar.
|
||||
|
||||
// Code generated by foo. DO NOT EDIT.
|
||||
|
||||
package foo
|
||||
|
||||
func f() {
|
||||
println("body")
|
||||
}
|
||||
Reference in New Issue
Block a user