rename variables according to golangci-lint rec.
This commit is contained in:
committed by
Umputun
parent
cbdf5f1e47
commit
717c4aa638
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user