| 1 |
# Initially, the Go language version is too low. |
| 2 |
exec gofumpt -l . |
| 3 |
! stdout . |
| 4 |
|
| 5 |
# We can give an explicitly newer version. |
| 6 |
exec gofumpt -lang=1.13 -l . |
| 7 |
stdout -count=1 'foo\.go' |
| 8 |
stdout -count=1 'nested[/\\]nested\.go' |
| 9 |
|
| 10 |
# If we bump the version in go.mod, it should be picked up. |
| 11 |
exec go mod edit -go=1.13 |
| 12 |
exec gofumpt -l . |
| 13 |
stdout -count=1 'foo\.go' |
| 14 |
! stdout 'nested' |
| 15 |
|
| 16 |
# Ensure we produce the output we expect, and that it's stable. |
| 17 |
exec gofumpt foo.go |
| 18 |
cmp stdout foo.go.golden |
| 19 |
exec gofumpt -d foo.go.golden |
| 20 |
! stdout . |
| 21 |
|
| 22 |
# We can give an explicitly older version, too |
| 23 |
exec gofumpt -lang=1.0 -l . |
| 24 |
! stdout . |
| 25 |
|
| 26 |
-- go.mod -- |
| 27 |
module test |
| 28 |
|
| 29 |
go 1.12 |
| 30 |
-- foo.go -- |
| 31 |
package p |
| 32 |
|
| 33 |
const ( |
| 34 |
i = 0 |
| 35 |
j = 022 |
| 36 |
k = 0o_7_5_5 |
| 37 |
l = 1022 |
| 38 |
) |
| 39 |
-- foo.go.golden -- |
| 40 |
package p |
| 41 |
|
| 42 |
const ( |
| 43 |
i = 0 |
| 44 |
j = 0o22 |
| 45 |
k = 0o_7_5_5 |
| 46 |
l = 1022 |
| 47 |
) |
| 48 |
-- nested/go.mod -- |
| 49 |
module nested |
| 50 |
|
| 51 |
go 1.11 |
| 52 |
-- nested/nested.go -- |
| 53 |
package p |
| 54 |
|
| 55 |
const ( |
| 56 |
i = 0 |
| 57 |
j = 022 |
| 58 |
k = 0o_7_5_5 |
| 59 |
l = 1022 |
| 60 |
) |