From b8e52c499fa94ebf59191fdcbf8b935e6584402a Mon Sep 17 00:00:00 2001 From: DmitriyLewen Date: Thu, 6 Jun 2024 10:01:07 +0600 Subject: [PATCH] refactor: update comment --- pkg/dependency/parser/nodejs/npm/parse.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/dependency/parser/nodejs/npm/parse.go b/pkg/dependency/parser/nodejs/npm/parse.go index 52cd39683225..6e99cdd1bfcb 100644 --- a/pkg/dependency/parser/nodejs/npm/parse.go +++ b/pkg/dependency/parser/nodejs/npm/parse.go @@ -216,7 +216,8 @@ func (p *Parser) resolveLinks(packages map[string]Package) { } workspaces := rootPkg.Workspaces - // Clone packages to avoid cases when we check already updated packages + // Changing the map during the map iteration causes unexpected behavior, + // so we need to iterate over the cloned `packages` map, but change the original `packages` map. for pkgPath, pkg := range maps.Clone(packages) { for linkPath, link := range links { if !strings.HasPrefix(pkgPath, link.Resolved) {