Skip to content

Commit

Permalink
Add reference for goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychhsu committed Mar 25, 2019
1 parent 6f6f328 commit 1db5ef1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions md_files/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ for _, val := range values {
}
```
If we don't pass the `val` to the inside function, the goroutine might not be executed until the for loop ends. Thus, we might see all goroutine print the last element.
<br />
**Reference** <br />
1. [Closure and goroutine](https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables)

### Channels
```go
Expand Down

0 comments on commit 1db5ef1

Please sign in to comment.