---
title: "Discussion on \"Eng Ver. Common mistakes with for loops in Go\" | Hashnode"
description: "Discussion on \"Eng Ver. Common mistakes with for loops in Go\". For loop + Goroutine + Closure\nThe program provided has the following code:\nfunc main() {\n    done := make(chan bool)\n\n    values := []string{\"a\", \"b\", \"c\"}\n    for _, v := range values {\n        go func() {\n            fmt.Println(v)\n            don..."
url: "https://hashnode.com/posts/eng-ver-common-mistakes-with-for-loops-in-go/651e48da3ac860011f32e786"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Eng Ver. Common mistakes with for loops in Go](https://ganhua.wang/eng-ver-common-mistakes-with-for-loops-in-go?utm_source=hashnode&utm_medium=feed)

For loop + Goroutine + Closure The program provided has the following code: func main() { done := make(chan bool) values := \[\]string{"a", "b", "c"} for \_, v := range values { go func() { fmt.Println(v) don...

Oct 5, 2023 · 6 min read · ganhua.wang  
Read the article

-   [#go](https://hashnode.com/tag/go)

## Written by

[雷N](https://hashnode.com/@nathanrayn)

@nathanrayn · Taipei, Taiwan

  
[View profile](https://hashnode.com/@nathanrayn)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
