Skip to content

Commit

Permalink
Merge pull request #62 from trailofbits/mschwager-known-fp
Browse files Browse the repository at this point in the history
Add test for known FP for iterate-over-empty-map
  • Loading branch information
mschwager authored Jun 6, 2024
2 parents 69fd8d8 + 7a412e6 commit c81344f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions go/iterate-over-empty-map.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func main() {
iter1_FP_2()
iter1_FP_3()
iter1_FP_4()
iter1_FP_5()
}

func iter1(){
Expand Down Expand Up @@ -72,3 +73,18 @@ func iter1_FP_4(){
fmt.Println("map item: ", v)
}
}

func iter1_FP_5() {
// https://github.com/semgrep/semgrep/issues/9558
// todook: iterate-over-empty-map
testMap := map[string]int{
"foo": 1,
"bar": 2,
}

keys := make([]string, 0, len(testMap))

for k := range testMap {
keys = append(keys, k)
}
}

0 comments on commit c81344f

Please sign in to comment.