Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddyfile: Fix minor bug in formatter
Matthew Holt committed
Dec 16, 2020 at 15:22 UTC
635f075f187ac73c65e6939b8402494469a4d627
2 files changed
+13
caddyconfig/caddyfile/formatter.go
+2
@@ -78,6 +78,8 @@ func Format(input []byte) []byte {
78
if comment {
79
if ch == '\n' {
80
comment = false
81
+ nextLine()
82
+ continue
83
} else {
84
write(ch)
85
continue
caddyconfig/caddyfile/formatter_test.go
+11
@@ -310,6 +310,17 @@ baz`,
310
input: `redir / /some/#/path`,
311
expect: `redir / /some/#/path`,
312
},
313
+ {
314
+ description: "brace does not fold into comment above",
315
+ input: `# comment
316
+{
317
+ foo
318
+}`,
319
+ expect: `# comment
320
+{
321
+ foo
322
+}`,
323
+ },
324
} {
325
// the formatter should output a trailing newline,
326
// even if the tests aren't written to expect that