Dima 2 éve
szülő
commit
eda856710d

+ 2 - 0
internal/fiber/fiber.go

@@ -77,10 +77,12 @@ func getConfig(sp interfaces.IServiceProvider) fiber.Config {
 func initEngine(env interfaces.IEnv) *html.Engine {
 	engine := html.New(templatesPath, ".html")
 
+	// nolint:gocritic
 	engine.AddFunc("now", func() time.Time {
 		return time.Now()
 	})
 
+	// nolint:gosec
 	engine.AddFunc("noescape", func(str string) template.HTML {
 		return template.HTML(str)
 	})

+ 1 - 0
internal/mapper/article.go

@@ -2,6 +2,7 @@ package mapper
 
 import (
 	"database/sql"
+
 	"github.com/dmitriygnatenko/internal/dto"
 	"github.com/dmitriygnatenko/internal/helpers"
 	"github.com/dmitriygnatenko/internal/models"

+ 2 - 2
internal/repositories/article_tag.go

@@ -26,7 +26,7 @@ func (a articleTagRepository) Add(ctx context.Context, articleID int, tagIDs []i
 
 	query := "INSERT INTO " + articleTagTableName + " (article_id, tag_id) VALUES "
 
-	var vals []interface{}
+	vals := make([]interface{}, 0, len(tagIDs)*2)
 	for _, tagID := range tagIDs {
 		query += "(?, ?),"
 		vals = append(vals, articleID, tagID)
@@ -45,7 +45,7 @@ func (a articleTagRepository) Delete(ctx context.Context, articleID int, tagIDs
 
 	query := "DELETE FROM " + articleTagTableName + " WHERE article_id = ? AND tag_id IN ("
 
-	var vals []interface{}
+	vals := make([]interface{}, 0, len(tagIDs)+1)
 	vals = append(vals, articleID)
 	for _, tagID := range tagIDs {
 		query += "?,"

+ 1 - 1
internal/service_provider/sp.go

@@ -1,4 +1,4 @@
-package service_provider
+package sp
 
 import (
 	"github.com/dmitriygnatenko/internal/interfaces"