From 717c4aa638d2e280673d82dc6e29ab77c97b60f8 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Mon, 17 May 2021 02:00:55 +0200 Subject: [PATCH] rename variables according to golangci-lint rec. --- backend/app/rest/api/rest_private.go | 4 ++-- backend/app/rest/api/rest_public.go | 4 ++-- backend/app/store/service/service.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/app/rest/api/rest_private.go b/backend/app/rest/api/rest_private.go index 3db49cbb..13ec3c0f 100644 --- a/backend/app/rest/api/rest_private.go +++ b/backend/app/rest/api/rest_private.go @@ -89,12 +89,12 @@ func (s *private) createCommentCtrl(w http.ResponseWriter, r *http.Request) { comment = s.commentFormatter.Format(comment) // check if images are valid - imgIds, err := s.imageService.ExtractPictures(comment.Text) + imgIDs, err := s.imageService.ExtractPictures(comment.Text) if err != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't extract pictures from comment text", rest.ErrCommentValidation) return } - for _, id := range imgIds { + for _, id := range imgIDs { _, err = s.imageService.Load(id) if err != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't load picture from the comment", rest.ErrImgNotFound) diff --git a/backend/app/rest/api/rest_public.go b/backend/app/rest/api/rest_public.go index f6c7efb0..b61e37e5 100644 --- a/backend/app/rest/api/rest_public.go +++ b/backend/app/rest/api/rest_public.go @@ -134,12 +134,12 @@ func (s *public) previewCommentCtrl(w http.ResponseWriter, r *http.Request) { comment.Sanitize() // check if images are valid - imgIds, err := s.imageService.ExtractPictures(comment.Text) + imgIDs, err := s.imageService.ExtractPictures(comment.Text) if err != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't extract pictures from comment text", rest.ErrCommentValidation) return } - for _, id := range imgIds { + for _, id := range imgIDs { _, err = s.imageService.Load(id) if err != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't load picture from the comment", rest.ErrImgNotFound) diff --git a/backend/app/store/service/service.go b/backend/app/store/service/service.go index 96957f86..a2b98548 100644 --- a/backend/app/store/service/service.go +++ b/backend/app/store/service/service.go @@ -235,15 +235,15 @@ func (s *DataStore) submitImages(comment store.Comment) { log.Printf("[WARN] can't get comment's %s text for image extraction, %v", comment.ID, err) return nil } - imgIds, err := s.ImageService.ExtractPictures(cc.Text) + imgIDs, err := s.ImageService.ExtractPictures(cc.Text) if err != nil { log.Printf("[WARN] can't get extract pictures from %s, %v", comment.ID, err) return nil } - if len(imgIds) > 0 { - log.Printf("[DEBUG] image ids extracted from %s - %+v", comment.ID, imgIds) + if len(imgIDs) > 0 { + log.Printf("[DEBUG] image ids extracted from %s - %+v", comment.ID, imgIDs) } - return imgIds + return imgIDs } var err error