Skip to content

Commit 7c48b5f

Browse files
authored
caddyfile: Switch to slices.Equal for better performance (#6061)
1 parent e965b11 commit 7c48b5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

caddyconfig/caddyfile/formatter.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
"bytes"
1919
"io"
2020
"unicode"
21+
22+
"golang.org/x/exp/slices"
2123
)
2224

2325
// Format formats the input Caddyfile to a standard, nice-looking
@@ -128,7 +130,7 @@ func Format(input []byte) []byte {
128130
heredocClosingMarker = heredocClosingMarker[1:]
129131
}
130132
// check if we're done
131-
if string(heredocClosingMarker) == string(heredocMarker) {
133+
if slices.Equal(heredocClosingMarker, heredocMarker) {
132134
heredocMarker = nil
133135
heredocClosingMarker = nil
134136
heredoc = heredocClosed

0 commit comments

Comments
 (0)