From 9f8325d2d185c6ad09c5dc5fc2ae10d3bc5e10bb Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 27 Aug 2015 16:05:07 +0200 Subject: [PATCH 01/12] Fix typos in c2.2 of the English version --- en/02.2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/en/02.2.md b/en/02.2.md index c1366cef..a91d84ab 100644 --- a/en/02.2.md +++ b/en/02.2.md @@ -107,7 +107,7 @@ Although int32 has a longer length than int8, and has the same type as int, you Float types have the `float32` and `float64` types and no type called `float`. The latter one is the default type if using brief statement. -That's all? No! Go supports complex numbers as well. `complex128` (with a 64-bit real and 64-bit imaginary part) is the default type, if you need a smaller type, there is one called `complex64` (with a 32-bit real and 32-bit imaginary part). Its form is `RE+IMi`, where `RE` is real part and `IM` is imaginary part, the last `i` is imaginary number. There is a example of complex number. +That's all? No! Go supports complex numbers as well. `complex128` (with a 64-bit real and 64-bit imaginary part) is the default type, if you need a smaller type, there is one called `complex64` (with a 32-bit real and 32-bit imaginary part). Its form is `RE+IMi`, where `RE` is real part and `IM` is imaginary part, the last `i` is the imaginary number. There is a example of complex number. var c complex64 = 5+5i //output: (5+5i) @@ -126,12 +126,12 @@ We just talked about how Go uses the UTF-8 character set. Strings are represente frenchHello = "Bonjour" // basic form of assign values } -It's impossible to change string values by index. You will get errors when you compile following code. +It's impossible to change string values by index. You will get errors when you compile the following code. var s string = "hello" s[0] = 'c' -What if I really want to change just one character in a string? Try following code. +What if I really want to change just one character in a string? Try the following code. s := "hello" c := []byte(s) // convert string to []byte type @@ -170,7 +170,7 @@ Go has one `error` type for purpose of dealing with error messages. There is als ### Underlying data structure -The following picture comes from an article about [Go data structure](http://research.swtch.com/godata) in [Russ Cox Blog](http://research.swtch.com/). As you can see, Go utilizes blocks of memory to store data. +The following picture comes from an article about [Go data structure](http://research.swtch.com/godata) in [Russ Cox's Blog](http://research.swtch.com/). As you can see, Go utilizes blocks of memory to store data. ![](images/2.2.basic.png?raw=true) From 38386091ec4a337b27cdc33f7d2100551e162090 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 27 Aug 2015 16:17:44 +0200 Subject: [PATCH 02/12] Fix typos in c2.4 of the English version --- en/02.4.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/en/02.4.md b/en/02.4.md index 37475678..d28a5358 100644 --- a/en/02.4.md +++ b/en/02.4.md @@ -133,9 +133,9 @@ Let's see one example. ![](images/2.4.student_struct.png?raw=true) -Figure 2.7 Inheritance in Student and Human +Figure 2.7 Embedding in Student and Human -We see that we can access the age and name fields in Student just like we can in Human. This is how embedded fields work. It's very cool, isn't it? Hold on, there's something cooler! You can even use Student to access Human in this embedded field! +We see that we can access the `age` and `name` fields in Student just like we can in Human. This is how embedded fields work. It's very cool, isn't it? Hold on, there's something cooler! You can even use Student to access Human in this embedded field! mark.Human = Human{"Marcus", 55, 220} mark.Human.age -= 1 @@ -176,7 +176,7 @@ All the types in Go can be used as embedded fields. fmt.Println("Her skills now are ", jane.Skills) // modify embedded field jane.int = 3 - fmt.Println("Her preferred number is", jane.int) + fmt.Println("Her preferred number is ", jane.int) } In the above example, we can see that all types can be embedded fields and we can use functions to operate on them. From 49dd14399346d691ae2d8b2e2a7b0c6f22cc87e8 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 27 Aug 2015 16:22:32 +0200 Subject: [PATCH 03/12] Fix typo in c2.5 of the English version --- en/02.5.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/02.5.md b/en/02.5.md index cc50b8af..38acb66b 100644 --- a/en/02.5.md +++ b/en/02.5.md @@ -204,7 +204,7 @@ We define some constants and customized types. Then we defined some methods for our customized types. -- Volume() uses Box as its receiver and returns volume of Box. +- Volume() uses Box as its receiver and returns the volume of Box. - SetColor(c Color) changes Box's color. - BiggestsColor() returns the color which has the biggest volume. - PaintItBlack() sets color for all Box in BoxList to black. From 7febe48bb84936a3e20c71d5431bce6801564a96 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 27 Aug 2015 16:25:42 +0200 Subject: [PATCH 04/12] Fix typo in c2.6 of the English version --- en/02.6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/02.6.md b/en/02.6.md index b87d63da..20dfbf2a 100644 --- a/en/02.6.md +++ b/en/02.6.md @@ -333,7 +333,7 @@ We can see that the source file in `container/heap` has the following definition type Interface interface { sort.Interface // embedded sort.Interface Push(x interface{}) //a Push method to push elements into the heap - Pop() interface{} //a Pop elements that pops elements from the heap + Pop() interface{} //a Pop method that pops elements from the heap } We see that `sort.Interface` is an embedded interface, so the above Interface has the three methods contained within the `sort.Interface` implicitly. From a99dfd0f13447dc861b0eb651f768ecdcf0ec11c Mon Sep 17 00:00:00 2001 From: Tomas Roos Date: Tue, 1 Sep 2015 14:22:32 +0200 Subject: [PATCH 05/12] Update 05.2.md Project has not been updated for 5 years, recommending it makes no sense anymore --- en/05.2.md | 1 - 1 file changed, 1 deletion(-) diff --git a/en/05.2.md b/en/05.2.md index 31a62247..dc938f97 100644 --- a/en/05.2.md +++ b/en/05.2.md @@ -8,7 +8,6 @@ There are a couple of drivers that support MySQL in Go. Some of them implement t - [https://github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) supports `database/sql`, written in pure Go. - [https://github.com/ziutek/mymysql](https://github.com/ziutek/mymysql) supports `database/sql` and user defined interfaces, written in pure Go. -- [https://github.com/Philio/GoMySQL](https://github.com/Philio/GoMySQL) only supports user defined interfaces, written in pure Go. I'll use the first driver in the following examples (I use this one in my personal projects too), and I also recommend that you use it for the following reasons: From 5891d7bd1936f366af9b8cc81b77cfd6ad722040 Mon Sep 17 00:00:00 2001 From: Goryudyuma Date: Sat, 5 Sep 2015 04:55:54 +0900 Subject: [PATCH 06/12] translate a Chinese into Japanese --- ja/07.4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ja/07.4.md b/ja/07.4.md index f883dd3f..1db936b3 100644 --- a/ja/07.4.md +++ b/ja/07.4.md @@ -272,7 +272,7 @@ emailが出力される場所では上のような方法で出力をすべてhtm template.Must(tErr.Parse(" some static text {{ .Name }")) } -讲输出如下内容 +出力は以下の内容となります: The first one parsed OK. The second one parsed OK. From 505f61f8dc25391c8e4b2156d808e36b0fcac6c4 Mon Sep 17 00:00:00 2001 From: Bruno Sato Date: Sun, 6 Sep 2015 12:26:33 -0300 Subject: [PATCH 07/12] translated not translated pieces, and corrected errors --- pt-br/01.2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pt-br/01.2.md b/pt-br/01.2.md index d53026d9..4a7b423c 100644 --- a/pt-br/01.2.md +++ b/pt-br/01.2.md @@ -137,8 +137,8 @@ Se você seguiu todos os passos anteriores corretamente, sua estrurura de diret beedb.go util.go -Now you are able to see the directory structure clearly; `bin` contains executable files, `pkg` contains compiled files and `src` contains package source files. -Agora que exclarevemos como Go gerencia dependencias e código fonte, vamos recaptular de forma rápida a estrutura; `bin` contém os executaveis, `pkg` bibliotecas ou pacotes compilados, `src` código fonte da sua aplicação e pacotes. +Agora você é capaz de ver claramente a estrutura do diretório `bin` contém arquivos executáveis, `pkg` contém arquivos compilados e `src` contém arquivos de origem do pacote. +Agora que esclarecemos como Go gerencia dependencias e código fonte, vamos recaptular de forma rápida a estrutura; `bin` contém os executaveis, `pkg` bibliotecas ou pacotes compilados, `src` código fonte da sua aplicação e pacotes. (O GOPATH no Windows é exibido como: `%GOPATH%`, como esse livro tem um foco em sistemas UNIX-Like, usuários Windows deverão realizar futuros ajustes para que tudo ocorra como esperado) From e3062dd6d0e349d400525830b9e11d8de0f142ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=BBarnowiecki?= Date: Sun, 6 Sep 2015 21:56:20 +0200 Subject: [PATCH 08/12] Fix script name --- en/01.4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/01.4.md b/en/01.4.md index d5fcdea1..405318f7 100644 --- a/en/01.4.md +++ b/en/01.4.md @@ -158,7 +158,7 @@ Figure 1.8 Vim intelligent completion for Go 4. Configure [gocode](https://github.com/nsf/gocode/) ~ cd $GOPATH/src/github.com/nsf/gocode/vim - ~ ./update.bash + ~ ./update.sh ~ gocode set propose-builtins true propose-builtins true ~ gocode set lib-path "/home/border/gocode/pkg/linux_amd64" From 4f2d6a6d4eaa1854fdfb34a11bbb19cb272140fe Mon Sep 17 00:00:00 2001 From: adityamenon-iom Date: Fri, 11 Sep 2015 16:47:53 +0530 Subject: [PATCH 09/12] Fixed backtick highlighting problem in one line. --- en/02.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/02.2.md b/en/02.2.md index c289d2ca..b48ed22a 100644 --- a/en/02.2.md +++ b/en/02.2.md @@ -157,7 +157,7 @@ What if I want to have a multiple-line string? m := `hello world` -`` ` will not escape any characters in a string. +``` ` ``` will not escape any characters in a string. ### Error types From e58301381e57cfaf7ba793e5ebeccdb81fc053db Mon Sep 17 00:00:00 2001 From: mitsuteru sawa Date: Sun, 13 Sep 2015 17:05:22 +0900 Subject: [PATCH 10/12] Correct Japanese MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit '関し' should be '監視'. --- ja/03.2.md | 2 +- ja/03.3.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ja/03.2.md b/ja/03.2.md index fa6b11be..a4b13c5f 100644 --- a/ja/03.2.md +++ b/ja/03.2.md @@ -52,7 +52,7 @@ 上のコードでWebサーバを書くためにはhttpパッケージの2つの関数を呼ぶだけで良いことがわかります。 ->もしあなたが以前PHPプログラマであれば。こう問うかもしれません。我々のnginx、apacheサーバは必要ないのですかと?なぜならこいつは直接tcpポートを関ししますので、nginxがやることをやってくれます。またsayhelloNameは実は我々が書いたロジック関数ですので、phpの中のコントローラ(controller)関数に近いものです。 +>もしあなたが以前PHPプログラマであれば。こう問うかもしれません。我々のnginx、apacheサーバは必要ないのですかと?なぜならこいつは直接tcpポートを監視しますので、nginxがやることをやってくれます。またsayhelloNameは実は我々が書いたロジック関数ですので、phpの中のコントローラ(controller)関数に近いものです。 >もしあなたがPythonプログラマであったのなら、tornadoを聞いたことがあると思います。このコードはそれとよく似ていませんか?ええ、その通りです。GoはPythonのような動的な言語によく似た特性を持っています。Webアプリケーションを書くにはとても便利です。 diff --git a/ja/03.3.md b/ja/03.3.md index 5bbcc423..e79b92ab 100644 --- a/ja/03.3.md +++ b/ja/03.3.md @@ -21,7 +21,7 @@ Handler:リクエストを処理し、返すデータを生成する処理ロ 図3.9 httpパッケージの実行フロー -1. Listen Socketを作成し、指定したポートを関しします。クライアントのリクエストを待ちます。 +1. Listen Socketを作成し、指定したポートを監視します。クライアントのリクエストを待ちます。 2. Listen Socketはクライアントのリクエストを受け付けます。Client Socketを得ると、Client Socketを通じてクライアントと通信を行います。  From e91614d64659e1b417d293d5f0c84838c4c8f042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=BBarnowiecki?= Date: Mon, 14 Sep 2015 22:37:05 +0200 Subject: [PATCH 11/12] Fix typo --- en/12.4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/12.4.md b/en/12.4.md index 4ff8217e..327cc6ab 100644 --- a/en/12.4.md +++ b/en/12.4.md @@ -6,7 +6,7 @@ In this section, we'll discuss another aspect of application management: data ba In most cluster environments, web applications do not need to be backed up since they are actually copies of code from our local development environment, or from a version control system. In many cases however, we need to backup data which has been supplied by the users of our site. For instance, when sites require users to upload files, we need to be able to backup any files that have been uploaded by users to our website. The current approach for providing this kind of redundancy is to utilize so-called cloud storage, where user files and other related resources are persisted into a highly available network of servers. If our system crashes, as long as user data has been persisted onto the cloud, we can at least be sure that no data will be lost. -But what about the cases where we did not backup our data to a cloud service, or where cloud storage was not an option? How do we backup data from our web applications then? Here, we describe a tool called rysnc, which can be commonly found on unix-like systems. Rsync is a tool which can be used to synchronize files residing on different systems, and a perfect use-case for this functionality is to keep our website backed up. +But what about the cases where we did not backup our data to a cloud service, or where cloud storage was not an option? How do we backup data from our web applications then? Here, we describe a tool called rsync, which can be commonly found on unix-like systems. Rsync is a tool which can be used to synchronize files residing on different systems, and a perfect use-case for this functionality is to keep our website backed up. > Note: Cwrsync is an implementation of rsync for the Windows environment From 1b201b9d8061a0a69bcbe8c3d7c528c1771f6bad Mon Sep 17 00:00:00 2001 From: Norbert Fuhs Date: Fri, 18 Sep 2015 16:26:51 +0200 Subject: [PATCH 12/12] Update 03.0.md --- de/03.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/de/03.0.md b/de/03.0.md index 11ee047c..e3b0cc5d 100644 --- a/de/03.0.md +++ b/de/03.0.md @@ -1,6 +1,6 @@ -#3 Web foundation +#3 Internet Grundlagen -The reason you are reading this book is that you want to learn to build web applications in Go. As I've said before, Go provides many powerful packages like `http`. These packages can help you a lot when trying to build web applications. I'll teach you everything you need to know in the following chapters, and we'll talk about some concepts of the web and how to run web applications in Go in this chapter. +Der Grund warum du dieses Buch liest, ist das du lernen möchtest wie man mit Go Webanwendungen erstellt. Wie ich schon sagte, stellt Go viele mächtige Pakete wie `http` zur Verfügung. Die Pakete können dir eine große Hilfe sein um Webanwendungen zu erstellen. In den nächsten Kapiteln werde ich dir hierzu alles beibringen, was du wissen musst. Wir werden in diesem Kapitel über einige Konzepte des Internet und wie man Webanwendung mit Go ausführt sprechen. ## Links