| 1 |
exec gofumpt -w foo.go |
| 2 |
cmp foo.go foo.go.golden |
| 3 |
|
| 4 |
exec gofumpt -d foo.go.golden |
| 5 |
! stdout . |
| 6 |
|
| 7 |
-- foo.go -- |
| 8 |
package p |
| 9 |
|
| 10 |
func f() { |
| 11 |
if true { |
| 12 |
|
| 13 |
println() |
| 14 |
} |
| 15 |
|
| 16 |
for true { |
| 17 |
println() |
| 18 |
|
| 19 |
} |
| 20 |
|
| 21 |
{ |
| 22 |
|
| 23 |
|
| 24 |
println(1, 2, |
| 25 |
3, 4, `foo |
| 26 |
bar`) |
| 27 |
|
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
{ |
| 32 |
|
| 33 |
// comment directly before |
| 34 |
println() |
| 35 |
|
| 36 |
// comment after |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
{ |
| 41 |
|
| 42 |
// comment before |
| 43 |
|
| 44 |
println() |
| 45 |
// comment directly after |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
// For readability; the empty line helps separate the multi-line |
| 50 |
// condition from the body. |
| 51 |
if true && |
| 52 |
true { |
| 53 |
|
| 54 |
println() |
| 55 |
} |
| 56 |
for true && |
| 57 |
true { |
| 58 |
|
| 59 |
println() |
| 60 |
} |
| 61 |
if true && |
| 62 |
true { |
| 63 |
|
| 64 |
// documented single statement |
| 65 |
println() |
| 66 |
} |
| 67 |
} |
| 68 |
-- foo.go.golden -- |
| 69 |
package p |
| 70 |
|
| 71 |
func f() { |
| 72 |
if true { |
| 73 |
println() |
| 74 |
} |
| 75 |
|
| 76 |
for true { |
| 77 |
println() |
| 78 |
} |
| 79 |
|
| 80 |
{ |
| 81 |
println(1, 2, |
| 82 |
3, 4, `foo |
| 83 |
bar`) |
| 84 |
} |
| 85 |
|
| 86 |
{ |
| 87 |
// comment directly before |
| 88 |
println() |
| 89 |
|
| 90 |
// comment after |
| 91 |
} |
| 92 |
|
| 93 |
{ |
| 94 |
// comment before |
| 95 |
|
| 96 |
println() |
| 97 |
// comment directly after |
| 98 |
} |
| 99 |
|
| 100 |
// For readability; the empty line helps separate the multi-line |
| 101 |
// condition from the body. |
| 102 |
if true && |
| 103 |
true { |
| 104 |
|
| 105 |
println() |
| 106 |
} |
| 107 |
for true && |
| 108 |
true { |
| 109 |
|
| 110 |
println() |
| 111 |
} |
| 112 |
if true && |
| 113 |
true { |
| 114 |
|
| 115 |
// documented single statement |
| 116 |
println() |
| 117 |
} |
| 118 |
} |