summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/commandfuncs.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index bc4c227..c5264ed 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -558,7 +558,10 @@ func cmdFmt(fl Flags) (int, error) {
if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil {
return caddy.ExitCodeFailedStartup, fmt.Errorf("overwriting formatted file: %v", err)
}
- } else if fl.Bool("diff") {
+ return caddy.ExitCodeSuccess, nil
+ }
+
+ if fl.Bool("diff") {
diff := difflib.Diff(
strings.Split(string(input), "\n"),
strings.Split(string(output), "\n"))