Commit Graph

44 Commits

Author SHA1 Message Date
Haigang Zhou
f08d76efa6 第十四章上半部分 (#836)
Co-authored-by: Joe Chen <jc@unknwon.io>
2022-05-17 16:24:13 +08:00
Jck
39dbdb7094 修改部分描述,添加必要的标点符号,补充代码超链接 (#804) 2021-10-25 23:34:42 +08:00
hgbj0001
381d375e40 Update 14.2.md (#796) 2021-10-23 12:00:15 +08:00
Xavier Zhao
717421efba mod: 14.2.11 修正 channel 的方向 (#764) 2020-03-27 19:12:42 +08:00
Xavier Zhao
677e10c6e9 14.2 语法本地化,将主语调整为协程,而非程序 (#763) 2020-03-20 20:53:47 +08:00
cashewnut
173fcc518c update comment (#747) 2019-12-13 23:38:44 -08:00
Pan Yao
c308fad89f Update 14.2.md (#742)
world “resouces” -> "resources"
2019-11-27 15:13:17 -08:00
DongGang
d112ab4821 优化14.2翻译 (#721) 2019-10-09 21:17:42 -07:00
marjune
6ed73bf4f5 Move images (#704)
* refactor: merge image directories into one

```bash
git mv -v images/* eBook/images/
sed -i -e 's;../images;images;g' eBook/*.md
```

* use correct chapter number for image names in 4.9

* use correct chapter number for image names in 7.2.4
2019-08-04 00:22:43 -07:00
Soulless
865fb2d64e 使语句通顺些,更容易读懂 (#703)
* 使语句通顺些,更容易读懂

* Update 14.2.md
2019-08-02 14:13:37 -07:00
marjune
9cc2c642cf Update 14.2.md (#666) 2019-07-08 19:57:58 -07:00
Respawnz
9363c0d07c 翻译建议 (#605)
* 翻译建议

英文原著:
> the  same  operator  <-  is  used  for  sending  and  receiving,  but  Go  figures  out  depending  on  the operands what to do. Although not necessary, for readability the channel name usually starts with ch  or  contains  ‘chan’. The  channel  send-  and  receive  operations  are  atomic:  they  always  complete without interruption.The use of the communication operator is illustrated in example

原译文:
>操作符 <- 也被用来发送和接收,Go 。尽管不必要,为了可读性,通道的命名通常以 ch 开头或者包含 chan。通道的发送和接收操作都是自动的:它们通常一气呵成。下面的示例展示了通信操作。

我的建议:
>同一个操作符 `<-` 既用于**发送**也用于**接收**,但Go会根据操作对象弄明白该干什么 。虽非强制要求,但为了可读性通道的命名通常以 `ch` 开头或者包含 `chan`。通道的发送和接收都是原子操作:它们总是互不干扰的完成的。下面的示例展示了通信操作的使用。

* 补个“符”字

* typical -> 典型

* 翻译建议

* Update 14.2.md

* Update 14.2.md

* Update 14.2.md
2019-04-25 15:48:15 -04:00
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