| 1 |
env GO111MODULE=off |
| 2 |
|
| 3 |
! go fmt does-not-exist |
| 4 |
|
| 5 |
go fmt -n exclude |
| 6 |
stdout 'exclude[/\\]x\.go' |
| 7 |
stdout 'exclude[/\\]x_linux\.go' |
| 8 |
|
| 9 |
# Test edge cases with gofmt. |
| 10 |
|
| 11 |
! exec $GOROOT/bin/gofmt does-not-exist |
| 12 |
|
| 13 |
exec $GOROOT/bin/gofmt gofmt-dir/no-extension |
| 14 |
stdout 'package x' |
| 15 |
|
| 16 |
exec $GOROOT/bin/gofmt gofmt-dir |
| 17 |
! stdout 'package x' |
| 18 |
|
| 19 |
! exec $GOROOT/bin/gofmt empty.go nopackage.go |
| 20 |
stderr -count=1 'empty\.go:1:1: expected .package., found .EOF.' |
| 21 |
stderr -count=1 'nopackage\.go:1:1: expected .package., found not' |
| 22 |
|
| 23 |
-- exclude/empty/x.txt -- |
| 24 |
-- exclude/ignore/_x.go -- |
| 25 |
package x |
| 26 |
-- exclude/x.go -- |
| 27 |
// +build linux,!linux |
| 28 |
|
| 29 |
package x |
| 30 |
-- exclude/x_linux.go -- |
| 31 |
// +build windows |
| 32 |
|
| 33 |
package x |
| 34 |
-- gofmt-dir/no-extension -- |
| 35 |
package x |
| 36 |
-- empty.go -- |
| 37 |
-- nopackage.go -- |
| 38 |
not the proper start to a Go file |