Skip to content

Commit

Permalink
Add test for known FP for iterate-over-empty-map
Browse files Browse the repository at this point in the history
  • Loading branch information
mschwager committed Jun 6, 2024
1 parent 69fd8d8 commit 7a412e6
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 7a412e6

Please sign in to comment.