From c66cb56f093198af62904e900e28c34017d939f2 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Thu, 23 Jan 2025 14:22:32 +0100 Subject: [PATCH] Add test to conver unit parssing for G115 rule (#1293) Signed-off-by: Cosmin Cojocar --- testutils/g115_samples.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/testutils/g115_samples.go b/testutils/g115_samples.go index 565050a4e1..c6c79ac5f4 100644 --- a/testutils/g115_samples.go +++ b/testutils/g115_samples.go @@ -843,4 +843,23 @@ func main() { } `, }, 1, gosec.NewConfig()}, + {[]string{ + ` + package main + + import ( + "fmt" + "strconv" + ) + + func main() { + a, err := strconv.ParseUint("100", 10, 16) + if err != nil { + panic("parse error") + } + b := uint16(a) + fmt.Printf("%d\n", b) + } + `, + }, 0, gosec.NewConfig()}, }