Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 18:15 UTC
caddyfile: Switch to slices.Equal for better performance (#6061)
bbaa committed
Jan 25, 2024 at 22:46 UTC
7c48b5fdbbd1e4a71023328fdb33c48f3346046d
1 file changed
+3
-1
caddyconfig/caddyfile/formatter.go
+3
-1
@@ -18,6 +18,8 @@ import (
18
"bytes"
19
"io"
20
"unicode"
21
+
22
+ "golang.org/x/exp/slices"
23
)
24
25
// Format formats the input Caddyfile to a standard, nice-looking
@@ -128,7 +130,7 @@ func Format(input []byte) []byte {
130
heredocClosingMarker = heredocClosingMarker[1:]
131
}
132
// check if we're done
131
- if string(heredocClosingMarker) == string(heredocMarker) {
133
+ if slices.Equal(heredocClosingMarker, heredocMarker) {
134
heredocMarker = nil
135
heredocClosingMarker = nil
136
heredoc = heredocClosed