| Josh Bleecher Snyder | 833a0f8 | 2025-04-24 18:39:36 +0000 | [diff] [blame] | 1 | Test autoformatting hierarchy |
| 2 | |
| 3 | -- bad.go -- |
| 4 | // This file is not properly gofmt'd. |
| 5 | package main |
| 6 | -- gofmt.go -- |
| 7 | // This file is properly gofmt'd. |
| 8 | package main |
| 9 | -- goimports.go -- |
| 10 | // This file is properly goimport'd, but not gofumpt'd. |
| 11 | package main |
| 12 | |
| 13 | import ( |
| 14 | "fmt" |
| 15 | ) |
| 16 | |
| 17 | func main() { |
| 18 | |
| 19 | fmt.Println("hi") |
| 20 | } |
| 21 | -- gofumpt.go -- |
| 22 | // This file is properly gofumpt'd. |
| 23 | package main |
| 24 | -- .commit -- |
| 25 | Initial commit |
| 26 | |
| 27 | -- bad.go -- |
| 28 | // This file is still not gofmt'd, but we won't complain, because it was already not gofmt'd. |
| 29 | package main |
| 30 | |
| 31 | import "fmt" |
| 32 | -- gofmt.go -- |
| 33 | // This file is no longer properly gofmt'd. |
| 34 | package main |
| 35 | -- goimports.go -- |
| 36 | // If we remove the imports, it no longer is goimport'd. |
| 37 | // It should thus be flagged as a formatting issue, despite being gofmt'd. |
| 38 | package main |
| 39 | |
| 40 | func main() { |
| 41 | |
| 42 | fmt.Println("hi") |
| 43 | } |
| 44 | -- gofumpt.go -- |
| 45 | // This file is properly gofmt'd, but no longer gofumpt'd. |
| 46 | package main |
| 47 | |
| 48 | func main() { |
| 49 | |
| 50 | fmt.Println("hi") |
| 51 | } |
| 52 | -- .commit -- |
| 53 | Mess with formatting |
| 54 | |
| 55 | -- .run_autoformat -- |
| 56 | /PATH/TO/REPO/gofmt.go |
| 57 | /PATH/TO/REPO/gofumpt.go |
| 58 | /PATH/TO/REPO/goimports.go |