1nwf / Produx-v2

Using a deprecated function, variable, constant or field GO-W1009
Anti-pattern
Major
7 months agoa year old
strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
11
12func UpdatePost(c *fiber.Ctx) error {
13	name := strings.TrimSpace(strings.ReplaceAll(c.Params("name"), "%20", " "))
14	field := strings.TrimSpace(strings.Title(strings.ToLower(c.Params("field"))))15	postId := c.Params("post_id")
16	newTitle := c.FormValue("title")
17	newDescription := c.FormValue("description")
strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
 20
 21func GetProducts(c *fiber.Ctx) error {
 22	name := strings.TrimSpace(strings.ReplaceAll(c.Params("name"), "%20", " "))
 23	field := strings.TrimSpace(strings.Title(strings.ToLower(c.Params("field")))) 24	var products []db.Product
 25
 26	page := c.Params("page")