{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/10168","labels_url":"https://api.github.com/repos/golang/go/issues/10168/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/10168/comments","events_url":"https://api.github.com/repos/golang/go/issues/10168/events","html_url":"https://github.com/golang/go/issues/10168","id":61803485,"number":10168,"title":"Correction golang.org","user":{"login":"olegdunkan","id":1710435,"avatar_url":"https://avatars.githubusercontent.com/u/1710435?v=3","gravatar_id":"","url":"https://api.github.com/users/olegdunkan","html_url":"https://github.com/olegdunkan","followers_url":"https://api.github.com/users/olegdunkan/followers","following_url":"https://api.github.com/users/olegdunkan/following{/other_user}","gists_url":"https://api.github.com/users/olegdunkan/gists{/gist_id}","starred_url":"https://api.github.com/users/olegdunkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olegdunkan/subscriptions","organizations_url":"https://api.github.com/users/olegdunkan/orgs","repos_url":"https://api.github.com/users/olegdunkan/repos","events_url":"https://api.github.com/users/olegdunkan/events{/privacy}","received_events_url":"https://api.github.com/users/olegdunkan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-15T12:17:32Z","updated_at":"2015-03-15T12:17:32Z","closed_at":null,"body":"http://golang.org/ref/mem#tmp_7\r\n\r\nThere is code: \r\nvar limit = make(chan int, 3)\r\n\r\nfunc main() {\r\n\tfor _, w := range work {\r\n\t\tgo func() {\r\n\t\t\tlimit <- 1\r\n\t\t\tw()\r\n\t\t\t<-limit\r\n\t\t}()\r\n\t}\r\n\tselect{}\r\n}\r\nI think it will be better this one:\r\n\r\nvar limit = make(chan int, 3)\r\n\r\nfunc main() {\r\n\tfor _, w := range work {\r\n                w:= w                                    //!!! it is the correction\r\n\t\tgo func() {\r\n\t\t\tlimit <- 1\r\n\t\t\tw()\r\n\t\t\t<-limit\r\n\t\t}()\r\n\t}\r\n\tselect{}\r\n}\r\n\r\n\r\n "}}