Skip to content

Commit

Permalink
caddyfile: Switch to slices.Equal for better performance (#6061)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaa-bbaa authored Jan 25, 2024
1 parent e965b11 commit 7c48b5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion caddyconfig/caddyfile/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"bytes"
"io"
"unicode"

"golang.org/x/exp/slices"
)

// Format formats the input Caddyfile to a standard, nice-looking
Expand Down Expand Up @@ -128,7 +130,7 @@ func Format(input []byte) []byte {
heredocClosingMarker = heredocClosingMarker[1:]
}
// check if we're done
if string(heredocClosingMarker) == string(heredocMarker) {
if slices.Equal(heredocClosingMarker, heredocMarker) {
heredocMarker = nil
heredocClosingMarker = nil
heredoc = heredocClosed
Expand Down

0 comments on commit 7c48b5f

Please sign in to comment.