From c6e31100b060d2e319d2d13684805833dfc327cb Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 13 Nov 2023 18:00:22 +0800 Subject: [PATCH] chore: use strings.Contains and bytes.Contains instead --- pkg/webdav/internal/xml/marshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/webdav/internal/xml/marshal.go b/pkg/webdav/internal/xml/marshal.go index cb82ec2143..6c20b3fa97 100644 --- a/pkg/webdav/internal/xml/marshal.go +++ b/pkg/webdav/internal/xml/marshal.go @@ -1042,14 +1042,14 @@ func (p *printer) marshalStruct(tinfo *typeInfo, val reflect.Value) error { switch k { case reflect.String: s := vf.String() - dashDash = strings.Index(s, "--") >= 0 + dashDash = strings.Contains(s, "--") dashLast = s[len(s)-1] == '-' if !dashDash { p.WriteString(s) } case reflect.Slice: b := vf.Bytes() - dashDash = bytes.Index(b, ddBytes) >= 0 + dashDash = bytes.Contains(b, ddBytes) dashLast = b[len(b)-1] == '-' if !dashDash { p.Write(b)