Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golang内存模型第一个bug的例子 #30

Open
shscy opened this issue Jun 13, 2018 · 3 comments
Open

golang内存模型第一个bug的例子 #30

shscy opened this issue Jun 13, 2018 · 3 comments

Comments

@shscy
Copy link

shscy commented Jun 13, 2018

在这个例子中,如果buffered chan 的长度为1,是不会有bug的吧?我在本地使用go run -race运行也不会有任何报错,您是否把buffered chan的长度误写为1?如果不是,麻烦您能详细解释一下吗,谢谢。

@tiancaiamao
Copy link
Owner

之前回答过了。
#19
#28

原因是这本书,写的时候 Go 还在是 1.0/1.1 版本。现在新版本的语言规范里面把这个行为改掉了。

先别关这个 issue,我决定后面抽空把它 fix 一下。@shscy

@jeffguorg
Copy link

感觉这两年go更新了好多东西,很多已经不大一样了。最近也是刚刚开始深入go

话说要不要readme注明一下基于go1.1

@hayden-pan
Copy link

我也是看到这个地方,实在无法理解了,测试了一下代码,也不会报错,所以跑来看看。看来作者也很忙啊,没空更新了😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants