Commit Graph

1274 Commits

Author SHA1 Message Date
marjune
c9cd16585e Update 10.6.md (#653)
Add original special word "method set"
2019-07-10 21:12:53 -07:00
marjune
9f4478c668 Update 11.9.md (#654) 2019-07-10 21:12:24 -07:00
iepngs
f2b2bdf5db Update 12.11.md (#655) 2019-07-10 21:12:04 -07:00
Johnsen
3d60a65988 09.5 修改pack1包中变量名PackFloat为pack1Float,保持本节教程代码和文本的一致性。 (#631)
* 修改pack1包中变量名PackFloat为pack1Float

* modify json.Decoder to json.NewDecoder
2019-07-10 21:11:51 -07:00
iepngs
0da9500027 pool.Mu.Lock()中lock方法首字母需要大写;切片名称错误;process的参数类型应该上下文统一; (#656) 2019-07-10 21:11:34 -07:00
marjune
65b2e5f971 Update 15.1 (#671) 2019-07-10 21:09:26 -07:00
marjune
243c87171f fix: apply official errata (#672)
see documentation:
https://sites.google.com/site/thewaytogo2012/the-gopher/Errata.pdf

see also:
https://sites.google.com/site/thewaytogo2012/the-gopher
2019-07-10 21:07:32 -07:00
marjune
d755ccc849 Update 15.2.md (#674)
* Update 15.2.md

* Update 15.2.md
2019-07-10 21:06:21 -07:00
marjune
4866b1922c Update 15.3.md (#675) 2019-07-10 21:05:02 -07:00
marjune
4b5092193f Update 12.2.md (#658) 2019-07-08 20:00:24 -07:00
iepngs
28a8afc954 修正错误使用了中文引号 (#659) 2019-07-08 19:59:55 -07:00
iepngs
cf2bbc8947 代码里中文符号更正 (#660) 2019-07-08 19:59:42 -07:00
marjune
8b3a8e03bb Update 12.4.md (#661) 2019-07-08 19:59:00 -07:00
marjune
6128a36b27 Update 12.9.md (#662) 2019-07-08 19:58:44 -07:00
marjune
e45628c48b Update 14.1.md (#665)
* Update 14.1.md

* Update 14.1.md
2019-07-08 19:58:28 -07:00
marjune
9cc2c642cf Update 14.2.md (#666) 2019-07-08 19:57:58 -07:00
marjune
89fd141c63 Update 14.5.md (#667)
* Update 14.5.md

* Update 14.5.md
2019-07-08 19:57:30 -07:00
marjune
115a66b766 Update 14.8.md (#668) 2019-07-08 19:55:23 -07:00
Loading Zhang
ba0218d96e 增加切片注释 (#621) 2019-04-30 19:42:34 -04:00
Kun Chen
b7cbab2090 Update 02.3.md (#618)
修正:
文件名和后文指令`go run hello_world1.go`保持一致。
2019-04-26 08:50:27 -04:00
Respawnz
4bed4b6cd7 示例序号错误 (#619) 2019-04-26 08:50:09 -04:00
Kun Chen
2806ae9c48 Update 03.4.md (#616)
更正:

`go build` 和 `go install` 命令的解释说反了。
2019-04-25 15:48:59 -04:00
Respawnz
8f0c9b1c8c effectively 有效的->实际上 (#615) 2019-04-25 15:48:36 -04: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
jiayao
76c3f8826f Update 02.3.md (#613)
修改两处表达不合理
2019-04-25 15:47:29 -04:00
jiayao
547aa40166 Update 02.7.md (#612)
修改了一处错别字
2019-04-25 15:47:09 -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
Respawnz
4a08451530 原书此处有误,按照原著183页正文里应该是7.14 (#604)
page:183
Exercise 7.14: string_reverse.go:Write a program that reverses a string, so “Google” is printed as ” elgooG”. (Hint: use a slice of bytes and conversions.)If you coded a solution with two slices, try a variant which uses only one (Hint: use swapping) If you want to be able to reverse Unicode-strings: use [ ]int !
2019-04-25 15:45:57 -04:00
Respawnz
c0daadf1c9 Update 13.4.md (#603)
Within a package, however, especially if there are deeply nested calls to non-exported functions, it can be useful (and improve readability) to use panic to indicate error conditions which should be translated into an error for the calling function.

原译文有机翻的感觉。鉴于英文原文这一段的句式,我觉得意思表达到了就行。
2019-04-25 15:45:40 -04:00
Respawnz
bfba02a8c4 练习序号有误 (#602)
Exercise 12. 6:cat_numbered.go
Extend the example from listing 12.8 to process a flag which indicates that every line read should be preceded by a line number in the output. Test it out with:  cat –n test
2019-04-15 12:36:26 -04:00
Humbertzhang
a73e43ede3 修正翻译错误 (#601)
原文:
A Go string is thus a sequence of variable-width characters (each 1 to 4 bytes, see Ex. 4.6), contrary to strings in other languages as C++, Java or Python that are fixed-width (Java uses always 2 bytes).
因此改为 “Go 中的字符串里面的字符” 更合适。
2019-04-13 08:13:27 -04:00
Respawnz
6f01acd7b1 原书中指定的练习题序号错误 (#600) 2019-04-08 10:32:50 -04:00
Respawnz
fac86b6c15 少了两个空格 (#599) 2019-04-08 10:32:33 -04:00
Respawnz
7aae332065 翻译更正+原书勘误+译者注 (#598)
* 翻译更正+译者注

原文:concatenates the string with itself.
为了便于理解增加了译者注

* 原书此处也是11.9,但实际上指的是练习11.11

原书此处也是11.9,但实际上指的是练习11.11

* 此处英文版原书有误,应该是练习10.16和10.17

* 原书此处有误,因为方法无法同时使用命名过的返回值和未命名的返回值

会报错:Method specification has both named and unnamed return parameters '(x interface{}, error)'

* 补漏+易读性提升

A function which has a (one or more) parameter of an interface type can be called with a variable(此处译文中漏掉) whose type implements that interface. 
其**实参**可以是任何实现了该接口的类型的变量
2019-04-08 10:32:18 -04:00
perry14
d6af03c9d1 Update 14.2.md (#596)
Fix a mistake.
2019-04-08 10:31:38 -04:00
ziposcar
5f078f6da7 Update 14.9 别字与翻译建议 (#595) 2019-03-26 18:45:21 -04:00
Respawnz
0f0d0b0331 翻译修正 (#592)
* 翻译修正

 A new value is put in the highest cell which is empty (contains 0), on top: this is called push.

* Update 10.7.md

原文中的which此处可省略掉,译文更通顺
2019-03-26 18:45:07 -04:00
ziposcar
d403aa7d76 Update 14.2.md 专有名词翻译 (#594)
专有名词翻译
2019-03-26 18:44:39 -04:00
ziposcar
d9e411062d Update 11.14.md 翻译修改建议 (#593)
1. 修正一同位语从句的误翻,应该是机翻没看到(the fact that ... 同位语表示相同地位)。保留了之前译者的补充。
2. 一处专用词修正“入参”->“参数”(其实改成“形参”也行,但原文没体现也不是重点)。
3. 补充一个语义不明的地方,因为原文的 those 的指代作用比中文丰富单看直翻不好理解。
2019-03-26 18:44:23 -04:00
ziposcar
b42e2fea6f 9.8 目录树层级对齐小调整 (#590) 2019-03-20 23:54:26 -04:00
ziposcar
3450f43d69 9.4 错别字修正 用过 -> 通过 (#589) 2019-03-20 15:58:56 -04:00
wenjieyan
c0fa994c1a 关于16.10错误处理的一些见解 (#587)
* Update 16.10.md

* Update 16.10.md

* add Discussion_about_16.10.md

* Update 16.10.md

* 修复超链接

* 更新超链接
2019-03-20 15:58:34 -04:00
Respawnz
ac62eb795b 翻译修正 (#584)
* 翻译修正

ISAM -> IsAM 
Exercise 9.4: The function which does the test is contained in a package even 将测试所用的函数编写在 even 包里。

https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/exercises/chapter_9/even/even.go
在练习源代码里也证实了这一点

* 修正我自己的pr

前文用的判断,后文应该也是判断,我的失误
2019-03-16 21:49:52 -04:00
燕睿涛
872c18fa42 Update 18.1.md (#585)
len([]int(str)) 修改为 len([]rune(str))
2019-03-16 21:49:31 -04:00
Respawnz
84a4014136 修正文件名 (#588)
* 修正文件名

* 修正一处练习序号
2019-03-16 21:48:03 -04:00
Respawnz
6c82ff3b75 翻译修改 (#583)
原文:This goes wrong of course when the original value items are not unique; in that case no error occurs, but the processing of the inverted map is simply stopped when a nonunique key is encountered, and it will most probably not contain all pairs from the original map!
我觉得这一句应该是因为编译器这种情况下不会报错才特地提醒的
虽然原文的这个句式有点让人费解...
2019-03-13 17:41:42 -04:00
Respawnz
d87d2e26d3 s和[]int之间应该加一个空格且 "slice"不属于代码部分 (#581) 2019-03-05 23:57:19 -05:00
Respawnz
1440039473 翻译修正 (#580)
翻译修正
2019-03-01 20:20:12 -05:00
MrTreasure
090466f6a5 fix:15.1一处方法调用错误 (#578) 2019-02-20 17:50:12 -05:00