From 160d19999982c4facd32c4bddced5a7dc91e8a40 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 19 Jan 2021 14:21:11 -0700 Subject: caddytest: Update Caddyfile tests for formatting, HTTP-only blocks Previous commit improved the Caddyfile adapter so it doesn't unnecessarily add names to "skip" in "auto_https" when the server is already HTTP-only. This commit updates the tests to reflect that change, while also fixing the Caddyfile formatting in many of the tests. We also print the line number of the divergence between input and formatted version in Caddyfile adapt warnings - very useful for finding initial formatting problems. --- cmd/commandfuncs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index bf24c24..3bf4b8d 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -529,6 +529,9 @@ func cmdAdaptConfig(fl Flags) (int, error) { adaptedConfig = prettyBuf.Bytes() } + // print result to stdout + fmt.Println(string(adaptedConfig)) + // print warnings to stderr for _, warn := range warnings { msg := warn.Message @@ -538,9 +541,6 @@ func cmdAdaptConfig(fl Flags) (int, error) { fmt.Fprintf(os.Stderr, "[WARNING][%s] %s:%d: %s\n", adaptCmdAdapterFlag, warn.File, warn.Line, msg) } - // print result to stdout - fmt.Println(string(adaptedConfig)) - // validate output if requested if adaptCmdValidateFlag { var cfg *caddy.Config -- cgit v1.2.3