mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 02:09:27 +08:00 
			
		
		
		
	cmd: caddy fmt return code is 1 if not formatted (#5297)
				
					
				
			* cmd: Fix caddy fmt if input isn't formatted * Fixes #5294 * return exit 1 with an error message * cmd: Use formattingDifference for caddy fmt * #5294 * expose caddyfile.formattingDifference
This commit is contained in:
		| @ -576,6 +576,10 @@ func cmdFmt(fl Flags) (int, error) { | ||||
| 		fmt.Print(string(output)) | ||||
| 	} | ||||
|  | ||||
| 	if warning, diff := caddyfile.FormattingDifference(formatCmdConfigFile, input); diff { | ||||
| 		return caddy.ExitCodeFailedStartup, fmt.Errorf("%s:%d: Caddyfile input is not formatted", warning.File, warning.Line) | ||||
| 	} | ||||
|  | ||||
| 	return caddy.ExitCodeSuccess, nil | ||||
| } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Y.Horie
					Y.Horie