From 7c48b5fdbbd1e4a71023328fdb33c48f3346046d Mon Sep 17 00:00:00 2001 From: bbaa Date: Thu, 25 Jan 2024 22:46:08 +0800 Subject: [PATCH] caddyfile: Switch to slices.Equal for better performance (#6061) --- caddyconfig/caddyfile/formatter.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/caddyconfig/caddyfile/formatter.go b/caddyconfig/caddyfile/formatter.go index 18753c65..764f7911 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