summaryrefslogtreecommitdiffhomepage
path: root/caddyconfig
diff options
context:
space:
mode:
authorbbaa <[email protected]>2024-01-25 22:46:08 +0800
committerGitHub <[email protected]>2024-01-25 14:46:08 +0000
commit7c48b5fdbbd1e4a71023328fdb33c48f3346046d (patch)
tree31bca932ed0e7beff93e9d906b79ec7dda21259e /caddyconfig
parente965b111cdf46109b4ed87e607e8dce5225105f4 (diff)
downloadcaddy-7c48b5fdbbd1e4a71023328fdb33c48f3346046d.tar.gz
caddy-7c48b5fdbbd1e4a71023328fdb33c48f3346046d.zip
caddyfile: Switch to slices.Equal for better performance (#6061)
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/caddyfile/formatter.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/caddyconfig/caddyfile/formatter.go b/caddyconfig/caddyfile/formatter.go
index 18753c65e..764f79118 100644
--- a/caddyconfig/caddyfile/formatter.go
+++ b/caddyconfig/caddyfile/formatter.go
@@ -18,6 +18,8 @@ import (
"bytes"
"io"
"unicode"
+
+ "golang.org/x/exp/slices"
)
// Format formats the input Caddyfile to a standard, nice-looking
@@ -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