Skip to content
This repository was archived by the owner on Nov 22, 2020. It is now read-only.
This repository was archived by the owner on Nov 22, 2020. It is now read-only.

bryanxu/go-zh: src/runtime/map_test.go; 23 LoC #841

Description

@githubvet

Found a possible issue in bryanxu/go-zh at src/runtime/map_test.go

The below snippet of Go code triggered static analysis which searches for goroutines and/or defer statements
which capture loop variables.

Click here to see the code in its original context.

Click here to show the 24 line(s) of Go which triggered the analyzer.
			for nr := 0; nr < numReader; nr++ {
				go func() {
					defer wg.Done()
					for range m {
					}
				}()
				go func() {
					defer wg.Done()
					for key := 0; key < gs; key++ {
						_ = m[key]
					}
				}()
				if useReflect {
					wg.Add(1)
					go func() {
						defer wg.Done()
						mv := reflect.ValueOf(m)
						keys := mv.MapKeys()
						for _, k := range keys {
							mv.MapIndex(k)
						}
					}()
				}
			}

commit ID: 1b0e138c5300dbf280dba2e2c9f4e43ec50c7d51

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions