diff options
author | bbaa <[email protected]> | 2024-01-25 22:46:08 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-25 14:46:08 +0000 |
commit | 7c48b5fdbbd1e4a71023328fdb33c48f3346046d (patch) | |
tree | 31bca932ed0e7beff93e9d906b79ec7dda21259e /caddyconfig/caddyfile/formatter.go | |
parent | e965b111cdf46109b4ed87e607e8dce5225105f4 (diff) | |
download | caddy-7c48b5fdbbd1e4a71023328fdb33c48f3346046d.tar.gz caddy-7c48b5fdbbd1e4a71023328fdb33c48f3346046d.zip |
caddyfile: Switch to slices.Equal for better performance (#6061)
Diffstat (limited to 'caddyconfig/caddyfile/formatter.go')
-rw-r--r-- | caddyconfig/caddyfile/formatter.go | 4 |
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 |