MM-52532: Fix golangci warnings for public module (#23918)

https://mattermost.atlassian.net/browse/MM-52532

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2023-06-30 20:12:56 +05:30
коммит произвёл GitHub
родитель d74ee1a3da
Коммит d9a28c1244
13 изменённых файлов: 73 добавлений и 77 удалений

Просмотреть файл

@@ -207,11 +207,11 @@ type AnalyticsPostCountsOptions struct {
}
func (o *PostPatch) WithRewrittenImageURLs(f func(string) string) *PostPatch {
copy := *o //nolint:revive
if copy.Message != nil {
*copy.Message = RewriteImageURLs(*o.Message, f)
pCopy := *o //nolint:revive
if pCopy.Message != nil {
*pCopy.Message = RewriteImageURLs(*o.Message, f)
}
return &copy
return &pCopy
}
func (o *PostPatch) Auditable() map[string]interface{} {
@@ -296,15 +296,15 @@ func (o *Post) ShallowCopy(dst *Post) error {
// Clone shallowly copies the post and returns the copy.
func (o *Post) Clone() *Post {
copy := &Post{} //nolint:revive
o.ShallowCopy(copy)
return copy
pCopy := &Post{} //nolint:revive
o.ShallowCopy(pCopy)
return pCopy
}
func (o *Post) ToJSON() (string, error) {
copy := o.Clone() //nolint:revive
copy.StripActionIntegrations()
b, err := json.Marshal(copy)
pCopy := o.Clone() //nolint:revive
pCopy.StripActionIntegrations()
b, err := json.Marshal(pCopy)
return string(b), err
}
@@ -707,12 +707,12 @@ var markdownDestinationEscaper = strings.NewReplacer(
// WithRewrittenImageURLs returns a new shallow copy of the post where the message has been
// rewritten via RewriteImageURLs.
func (o *Post) WithRewrittenImageURLs(f func(string) string) *Post {
copy := o.Clone()
copy.Message = RewriteImageURLs(o.Message, f)
if copy.MessageSource == "" && copy.Message != o.Message {
copy.MessageSource = o.Message
pCopy := o.Clone()
pCopy.Message = RewriteImageURLs(o.Message, f)
if pCopy.MessageSource == "" && pCopy.Message != o.Message {
pCopy.MessageSource = o.Message
}
return copy
return pCopy
}
// RewriteImageURLs takes a message and returns a copy that has all of the image URLs replaced