Skip to content

Commit b8e52c4

Browse files
committed
refactor: update comment
1 parent a2d1871 commit b8e52c4

File tree

1 file changed

+2
-1
lines changed
  • pkg/dependency/parser/nodejs/npm

1 file changed

+2
-1
lines changed

pkg/dependency/parser/nodejs/npm/parse.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ func (p *Parser) resolveLinks(packages map[string]Package) {
216216
}
217217

218218
workspaces := rootPkg.Workspaces
219-
// Clone packages to avoid cases when we check already updated packages
219+
// Changing the map during the map iteration causes unexpected behavior,
220+
// so we need to iterate over the cloned `packages` map, but change the original `packages` map.
220221
for pkgPath, pkg := range maps.Clone(packages) {
221222
for linkPath, link := range links {
222223
if !strings.HasPrefix(pkgPath, link.Resolved) {

0 commit comments

Comments
 (0)