Skip to content

Commit 1797af6

Browse files
committed
do not modify the map we are iterating on
1 parent 85e3ace commit 1797af6

File tree

1 file changed

+6
-5
lines changed
  • framework/components/dockercompose/chip_ingress_set

1 file changed

+6
-5
lines changed

framework/components/dockercompose/chip_ingress_set/protos.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ func RegisterAndFetchProtos(ctx context.Context, client *github.Client, protoSch
139139
// or in other words, we treat "workflows/" folder as the root folder for all protos in this schema set and strip it from the paths derived from the repository structure.
140140
prefixesToStrip := determineFolderPrefixesToStrip(protoSchemaSet.Folders)
141141

142+
strippeProtdMap := make(map[string]string)
143+
strippedSubjects := make(map[string]string)
144+
142145
for path := range protoMap {
143146
strippedPath := stripFolderPrefix(path, prefixesToStrip)
144-
protoMap[strippedPath] = protoMap[path]
145-
subjects[strippedPath] = subjects[path]
146-
delete(protoMap, path)
147-
delete(subjects, path)
147+
strippeProtdMap[strippedPath] = protoMap[path]
148+
strippedSubjects[strippedPath] = subjects[path]
148149
}
149150

150-
registerErr := registerAllWithTopologicalSorting(schemaRegistryURL, protoMap, subjects)
151+
registerErr := registerAllWithTopologicalSorting(schemaRegistryURL, strippeProtdMap, strippedSubjects)
151152
if registerErr != nil {
152153
return errors.Wrapf(registerErr, "failed to register protos from %s", protoSchemaSet.URI)
153154
}

0 commit comments

Comments
 (0)