|
13 | 13 | echo "Running in fix mode (formatting will be modified)" |
14 | 14 | fi |
15 | 15 |
|
16 | | -# Run both formatters in parallel |
17 | | -echo "Running Go and webui formatters in parallel..." |
18 | | - |
19 | | -# Run Go formatting in background |
20 | | -( |
21 | | - echo "Checking Go formatting..." |
22 | | - if [ "$CHECK_MODE" = true ]; then |
23 | | - # In check mode, we want to display the files that need formatting and exit with error if any |
24 | | - FILES_TO_FORMAT=$(gofumpt -l .) |
25 | | - if [ -n "$FILES_TO_FORMAT" ]; then |
26 | | - echo "The following Go files need formatting:" |
27 | | - echo "$FILES_TO_FORMAT" |
28 | | - exit 1 |
29 | | - else |
30 | | - echo "Go formatting check passed" |
31 | | - fi |
| 16 | +# Go formatting with gofumpt |
| 17 | +echo "Checking Go formatting..." |
| 18 | +if [ "$CHECK_MODE" = true ]; then |
| 19 | + # In check mode, we want to display the files that need formatting and exit with error if any |
| 20 | + FILES_TO_FORMAT=$(gofumpt -l .) |
| 21 | + if [ -n "$FILES_TO_FORMAT" ]; then |
| 22 | + echo "The following Go files need formatting:" |
| 23 | + echo "$FILES_TO_FORMAT" |
| 24 | + exit 1 |
32 | 25 | else |
33 | | - # In fix mode, we apply the formatting |
34 | | - echo "Fixing Go formatting with gofumpt" |
35 | | - gofumpt -w . |
36 | | - echo "Go formatting complete" |
| 26 | + echo "Go formatting check passed" |
37 | 27 | fi |
38 | | -) & |
39 | | -GO_PID=$! |
| 28 | +else |
| 29 | + # In fix mode, we apply the formatting |
| 30 | + echo "Fixing Go formatting with gofumpt" |
| 31 | + gofumpt -w . |
| 32 | + echo "Go formatting complete" |
| 33 | +fi |
40 | 34 |
|
41 | | -# Run webui formatting in background |
42 | | -( |
43 | | - echo "Checking webui formatting..." |
44 | | - if [ -d "./webui" ]; then |
45 | | - cd webui |
46 | | - if [ "$CHECK_MODE" = true ]; then |
47 | | - echo "Checking webui formatting with Prettier" |
48 | | - if ! npx [email protected] --check .; then |
49 | | - echo "Webui files need formatting" |
50 | | - exit 1 |
51 | | - fi |
52 | | - else |
53 | | - echo "Fixing webui formatting with Prettier" |
54 | | - |
55 | | - echo "Webui formatting complete" |
| 35 | +# Webui formatting with Prettier |
| 36 | +echo "Checking webui formatting..." |
| 37 | +if [ -d "./webui" ]; then |
| 38 | + cd webui |
| 39 | + if [ "$CHECK_MODE" = true ]; then |
| 40 | + echo "Checking webui formatting with Prettier" |
| 41 | + if ! npx [email protected] --check .; then |
| 42 | + echo "Webui files need formatting" |
| 43 | + exit 1 |
56 | 44 | fi |
57 | 45 | else |
58 | | - echo "No webui directory found, skipping Prettier check" |
| 46 | + echo "Fixing webui formatting with Prettier" |
| 47 | + |
| 48 | + echo "Webui formatting complete" |
59 | 49 | fi |
60 | | -) & |
61 | | -WEBUI_PID=$! |
62 | | - |
63 | | -# Wait for both processes and capture exit codes |
64 | | -wait $GO_PID |
65 | | -GO_EXIT=$? |
66 | | -wait $WEBUI_PID |
67 | | -WEBUI_EXIT=$? |
68 | | - |
69 | | -# Exit with error if either formatter failed |
70 | | -if [ $GO_EXIT -ne 0 ] || [ $WEBUI_EXIT -ne 0 ]; then |
71 | | - exit 1 |
| 50 | +else |
| 51 | + echo "No webui directory found, skipping Prettier check" |
72 | 52 | fi |
73 | 53 |
|
74 | 54 | if [ "$CHECK_MODE" = true ]; then |
|
0 commit comments