Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caddyfile: Switch to slices.Equal for better performance #6061

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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