From a0794a9366e188d5c3f90ec5599b7213ecf8558b Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 12:13:10 +0000 Subject: [PATCH] Replace manual trimming with `strings.TrimPrefix` --- pkg/proc/variables.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index cb96659e70..01e46c7bda 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -2382,9 +2382,7 @@ func (cm constantsMap) Get(typ godwarf.Type) *constantType { ctyp.initialized = true sort.Sort(constantValuesByValue(ctyp.values)) for i := range ctyp.values { - if strings.HasPrefix(ctyp.values[i].name, typepkg) { - ctyp.values[i].name = ctyp.values[i].name[len(typepkg):] - } + ctyp.values[i].name = strings.TrimPrefix(ctyp.values[i].name, typepkg) if popcnt(uint64(ctyp.values[i].value)) == 1 { ctyp.values[i].singleBit = true }