mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
go2idl: don't mutate a map being iterated
This was causing us to process packages we didn't really want, which was only visible when debugging was enabled.
This commit is contained in:
parent
96c0284e91
commit
ab16ccc158
@ -337,7 +337,13 @@ func (b *Builder) typeCheckPackage(id string) (*tc.Package, error) {
|
|||||||
|
|
||||||
func (b *Builder) makePackages() error {
|
func (b *Builder) makePackages() error {
|
||||||
b.pkgs = map[string]*tc.Package{}
|
b.pkgs = map[string]*tc.Package{}
|
||||||
|
|
||||||
|
// Take a snapshot to iterate, since this will recursively mutate b.parsed.
|
||||||
|
keys := []string{}
|
||||||
for id := range b.parsed {
|
for id := range b.parsed {
|
||||||
|
keys = append(keys, id)
|
||||||
|
}
|
||||||
|
for _, id := range keys {
|
||||||
// We have to check here even though we made a new one above,
|
// We have to check here even though we made a new one above,
|
||||||
// because typeCheckPackage follows the import graph, which may
|
// because typeCheckPackage follows the import graph, which may
|
||||||
// cause a package to be filled before we get to it in this
|
// cause a package to be filled before we get to it in this
|
||||||
|
Loading…
Reference in New Issue
Block a user