Created
September 20, 2021 08:21
-
-
Save cideM/a9de1dd2c5845232833308124d03a7df to your computer and use it in GitHub Desktop.
Fix the first deadlock
This file contains 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
diff --git a/main.go b/main.go | |
index 92bcd33..5c20c9f 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -7,9 +7,12 @@ import ( | |
func producer(strings []string) (<-chan string, error) { | |
outChannel := make(chan string) | |
- for _, s := range strings { | |
- outChannel <- s | |
- } | |
+ go func() { | |
+ | |
+ for _, s := range strings { | |
+ outChannel <- s | |
+ } | |
+ }() | |
return outChannel, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment