Skip to content

Commit

Permalink
caddyfile: Switch to slices.Equal for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaa-bbaa committed Jan 25, 2024
1 parent b9c40e7 commit 454847c
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 454847c

Please sign in to comment.