Commit Graph

32 Commits

Author SHA1 Message Date
Respawnz
0782788201 原著引用章节有误 (#609) 2019-04-25 15:46:53 -04:00
Respawnz
43672654ca 从翻译上调整了一下英文原著解释中的因果顺序 (#606)
* 建议从翻译上调转了一下英文原著解释中的因果顺序

英文原著:
> Notice the use of the closure:  the current i, xi are passed to the closure as parameters, masking the i, xi variables from the outer for-loop.  This allows each goroutine to have its own copy of i, xi; otherwise, the next iteration of the for-loop would update i, xi in all goroutines. On the other hand, the res slice is not passed to the closure, since each goroutine does not need a separate copy of it.  The res slice is part of the closure’s environment but is not a parameter

原译文:
>注意闭合:i、xi 都是作为参数传入闭合函数的,从外层循环中隐藏了变量 i 和 xi。让每个协程有一份 i 和 xi 的拷贝;另外,for 循环的下一次迭代会更新所有协程中 i 和 xi 的值。切片 res 没有传入闭合函数,因为协程不需要单独拷贝一份。切片 res 也在闭合函数中但并不是参数。

 我的建议:
>注意上述代码中闭合函数的用法:`i`、`xi` 都是作为参数传入闭合函数的,这一做法使得每个协程有一份 `i` 和 `xi` 的拷贝,从而向闭合函数内部隐藏了外层循环中的变量 `i` 和 `xi`;否则,for 循环的下一次迭代会更新所有协程中 `i` 和 `xi` 的值。另一方面,切片 `res` 没有传入闭合函数,因为协程不需要`res`的单独拷贝。切片 `res` 也在闭合函数中但并不是参数。

* 增加了译者注和一些用词调整
2019-04-25 15:46:37 -04:00
perry14
d6af03c9d1 Update 14.2.md (#596)
Fix a mistake.
2019-04-08 10:31:38 -04:00
ziposcar
d403aa7d76 Update 14.2.md 专有名词翻译 (#594)
专有名词翻译
2019-03-26 18:44:39 -04:00
wisecsj
8db0eb3957 Fix typo: Practice 14.5 (#571)
14.2.md
2019-02-01 14:58:19 -05:00
Darran Zhang
2e634e2c17 Fix a variable spelling mistake. (#563) 2019-01-29 20:25:00 -05:00
Grenade
aadf4f12fe fix sample code bug & reformat some sample code (#557)
* Update 01.2.md

删除:
- 不支持断言

* Formatting 问题5.1 code

* Formatting 问题5.3 code

* Correct the translation

- correct `令 v := map1[key1] 可以将 key1 对应的值赋值为 v` to `令 v := map1[key1] 可以将 key1 对应的值赋值给 v`

* Modified sample code

- Add `defer fi.Close()` on `示例 12.7`

* Reformatting some sample code on 13.3

* Update 14.2.md

* Reformatting the sample code.
2018-11-22 07:22:11 -05:00
Joy_Zhang
cf7001dcd0 Update 14.2.md (#550) 2018-10-23 04:08:41 -04:00
Joy_Zhang
35b747efad tokoi -> tokyo (#552) 2018-10-23 04:08:15 -04:00
crackedcd
86880b1bed Update 14.2.md (#542)
返回的通道的传递类型应为 item. 方法定义的返回类型, 应和方法体中return的一致, 即make(chan item).
2018-09-09 09:14:33 -04:00
Lynn
de3c7dbdc9 Fix #520 (#521) 2018-07-16 17:11:40 +08:00
Lynn
a30c3bb4a0 Fix #513 (#519)
* Fix #513

* Change code block to bold
2018-07-16 06:20:53 +08:00
Neal Caffery
80b3ba64d2 fix the wrong comment (#446)
the original words are :
A channel type may be annotated to specify that it may only send or only receive in certain code:
var send_only chan<- int // channel can only receive data
var recv_only <-chan int // channel can only send data
2018-04-05 17:25:59 -04:00
dcb1
0de63999be 错别字更正 (#376)
* Update 15.2.md

* Update 15.2.md

* Update 14.2.md
2017-06-25 07:59:15 -04:00
冯琪超
6589aef31f update "tw-way pipe" to "tow-way pipe" (#362)
* update "tw-way pipe" to "tow-way pipe"

update "tw-way pipe" to "tow-way pipe"

* update "tw-way pipe" to "two-way pipe"

update "tw-way pipe" to "two-way pipe" and not "tow....."    lol~~
2017-06-05 13:10:40 -04:00
Instrye
3e36ed2d15 更改:练习 14.4中 睡眠时间为2e9
测试证明getData 与 main 中都睡眠 1e9的情况下 程序仍有可能会输出内容
2017-03-28 10:36:10 +08:00
htlhenry
8d85f78031 go关键字之后的匿名函数需要加上()
go关键字之后的匿名函数需要加上()
2017-02-15 17:39:44 +08:00
htlhenry
235fef348a 语序勘误
语序勘误
2017-02-15 16:40:54 +08:00
王耀
86b9d6f7ef 更新链接、修正全角括号 (#281)
* Update 07.3.md

* Update 07.3.md

* Update 07.6.md

* fix few problems

* Update 10.6 and 10.8

* Update 11.6 and 11.7

* fix some problems before Chap13

* add a dot

* Update 13.9

* little improve
2016-09-04 06:04:40 -04:00
Jingke Tian
77f672c112 6.1 章节 对函数的参数与返回值表述不准确 (#257)
* 对于函数的参数与返回值表述不准确

原表述为:
“所有类型的函数都可以有参数与返回值。函数参数、返回值以及它们的类型被统称为函数签名。”
但是,main()与init()这两函数不允许有参数与返回值,故修改为:
“除了main()、init()函数外,其它所有类型的函数都可以有参数与返回值。函数参数、返回值以及它们的类型被统称为函数签名。”

* 笔误。

* 笔误,重复的chan

* 注释错误
2016-06-03 01:42:18 -07:00
songleo
9acf3a03f9 modified: eBook/14.2.md
modified:   eBook/14.4.md
2016-01-11 11:20:14 +08:00
songleo
2df6179a14 review 2016-01-08 11:57:46 +08:00
Unknwon
5e06368e45 14.2 2016-01-04 06:29:34 +08:00
glight2000
1f352b20ea Update 14.2.md 2015-12-29 10:52:38 +08:00
glight2000
c99e433197 Update 14.2.md 2015-12-28 23:46:34 +08:00
glight2000
585b0786d2 Update 14.2.md 2015-12-28 23:41:14 +08:00
glight2000
c1466e58c9 完成14.2 2015-12-28 23:36:19 +08:00
glight2000
08ed796b24 Update 14.2.md 2015-12-26 22:20:28 +08:00
glight2000
7f82cbd0cd Update 14.2.md 2015-12-26 17:19:39 +08:00
glight2000
5095fe05c3 Update 14.2.md 2015-12-26 15:28:40 +08:00
glight2000
877d5f37bf Update 14.2.md 2015-12-25 22:07:13 +08:00
glight2000
87184288ee Create 14.2.md 2015-12-25 13:34:53 +08:00