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