Last active
January 24, 2024 22:12
-
-
Save mpenick/83ac6b119a5cf6da90e3cfc011d50b11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
defer func() { | |
if r := recover(); r != nil { | |
panic("never called") | |
} | |
}() | |
// fatal error: concurrent map writes | |
m := make(map[int]int) | |
for i := 0; i < 100; i++ { | |
go func(i int) { | |
m[i] = i | |
}(i) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment