diff --git a/TRANSLATE.md b/TRANSLATE.md new file mode 100644 index 0000000000..ddab8ca3c4 --- /dev/null +++ b/TRANSLATE.md @@ -0,0 +1,36 @@ +# 翻译流程 +## 翻译内容 +1. `studygolang/website`下 `/content/static`中的 `*.html`。 +2. `studygolang/go`下 `src` 目录中的标准库 `*.go`。 +3. `studygolang/go`下 `doc`目录中 `*.html` 。 +## 基础工作 +1. fork [`https://github.com/studygolang/go`](https://github.com/studygolang/go)的代码到自己的仓库。 +2. clone go项目 到本地之后,切换到`release-branch.go1.15` 分支 +3. clone 本项目(website) 到本地 +```bash +git clone https://github.com.cnpmjs.org/studygolang/website.git +git clone https://github.com.cnpmjs.org/your-name/go.git +cd go +git checkout release-branch.go1.15 +``` + +## 提翻译issue +1. 在上面的翻译内容列表里找想要翻译的模块或者文件。 + 同时去issue中查看是否有人已经在翻译了,如果没有就可以翻译。 +2. 在本项目中(website) 发起一个issue,名字类似于:`翻译:标准库image`等表明自己需要翻译的文档。 + +## 开始翻译 +1. 在 go `release-branch.go1.15`或者 website 的 `master`分支 的基础上 检出一个分支,在该分支下做文档翻译 `git checkout -b your-branch`。 +2. 翻译规范请参照[`https://github.com/studygolang/GCTT/blob/master/chinese-copywriting-guidlines.md`](https://github.com/studygolang/GCTT/blob/master/chinese-copywriting-guidlines.md) +2. 可以在 webiste目录下,启动本地server,在`localhost:6060`下查看自己的文档翻译效果 `go run ./cmd/golangorg -goroot=../go` +3. push到自己的远端 + +## 提pr +1. 在`studygolang/go` 或 `studygolang/website` 项目中,发起pull request,等待合入。 +2. 在`pull request` 中加入 `close close studygolang/website#your-{issueId}`可在pr合入时自动关闭issue。 + +## 建议 +1. 最好一个模块单独一个issue和pr +2. 建议先启动 server 看看需要改动哪些,`_test.go`,未导出变量等等均可不用翻译。 +3. 如果发现还有需要改动的地方,也可以先转为 draft ,等修改完成之后再合入。 +3. 提 pr 之后如果有问题,可以直接在原pr上改,最好别重新提 pr。 diff --git a/_content/doc/code.html b/_content/doc/code.html index 99a1729a28..da6c3e650b 100644 --- a/_content/doc/code.html +++ b/_content/doc/code.html @@ -1,79 +1,65 @@ -
-This document demonstrates the development of a simple Go package inside a -module and introduces the go tool, the standard way to -fetch, build, and install Go modules, packages, and commands. + 此文档演示了如何在模块中开发一个简单的 Go 包,并介绍了用于获取、构建和安装 Go 模块、包和命令的标准方法 go tool。
+
-Note: This document assumes that you are using Go 1.13 or later and the
-GO111MODULE
environment variable is not set. If you are looking for
-the older, pre-modules version of this document, it is archived
-here.
+ 注: 本文需要 Go 1.13 或更高的版本,并且未对
+ GO111MODULE
进行设置。 如果您在寻找此文档的旧版本,请点击
+ 这里进行查看。
-Go programs are organized into packages. A package is a collection -of source files in the same directory that are compiled together. Functions, -types, variables, and constants defined in one source file are visible to all -other source files within the same package. + Go 程序通过包进行组织。包是同一目录中一起编译的源文件的集合。 + 在一个源文件中定义的函数、类型、变量和常量对于同一个包中其他源文件可见。
+
-A repository contains one or more modules. A module is a collection
-of related Go packages that are released together. A Go repository typically
-contains only one module, located at the root of the repository. A file named
-go.mod
there declares the module path: the import path
-prefix for all packages within the module. The module contains the packages in
-the directory containing its go.mod
file as well as subdirectories
-of that directory, up to the next subdirectory containing another
-go.mod
file (if any).
+ 一个代码仓库(repository)包含一个或多个模块。而模块是一起发布的相关 Go 包的集合。
+ 一个 Go 代码仓库通常只包含一个位于项目根目录的模块。在根目录文件 go.mod
中声明了
+ 模块内所有软件包的导入路径前缀。而该模块包含了 go.mod
文件中和位于该模块根目录到下一个包含 go.mod
文件(如果有)子目录中的包。
-Note that you don't need to publish your code to a remote repository before you -can build it. A module can be defined locally without belonging to a repository. -However, it's a good habit to organize your code as if you will publish it -someday. + 注:你不需要在构建代码之前将代码发布到远程代码仓库中。模块可以在本地定义,不需要依赖代码仓库。 + 但是,将代码结构标准化是一个好的习惯。
-Each module's path not only serves as an import path prefix for its packages,
-but also indicates where the go
command should look to download it.
-For example, in order to download the module golang.org/x/tools
,
-the go
command would consult the repository indicated by
-https://golang.org/x/tools
(described more here).
+ 每个模块的路径不仅仅是其充当软件包时的导入路径前缀,还指示 go
命令下载它的地址。
+ 例如,为了下载模块 golang.org/x/tools
,
+ go
命令将会查询 https://golang.org/x/tools
所指示的存储仓库(详细说明请查看 这里)。
-An import path is a string used to import a package. A package's
-import path is its module path joined with its subdirectory within the module.
-For example, the module github.com/google/go-cmp
contains a package
-in the directory cmp/
. That package's import path is
-github.com/google/go-cmp/cmp
. Packages in the standard library do
-not have a module path prefix.
+ 导入路径用于导入软件包。包的导入路径是其模块路径前缀加上其在模块中的子目录路径。
+ 例如,模块 github.com/google/go-cmp
子目录中包含 cmp/
包,
+ 那么,cmp 包的导入路径是 github.com/google/go-cmp/cmp
。但是,标准库中的软件包没有模块路径前缀。
-To compile and run a simple program, first choose a module path (we'll use
-example.com/user/hello
) and create a go.mod
file that
-declares it:
+ 为了编译并运行一个简单的程序,首先需要选择一个模块路径(我们将使用 example.com/user/hello
),
+ 然后创建一个声明该路径的 go.mod
文件:
-$ mkdir hello # Alternatively, clone it if it already exists in version control. +$ mkdir hello # 或者从已有的远程仓库中git clone $ cd hello -$ go mod init example.com/user/hello +$ go mod init example.com/user/hello # 译者:创建 go.mod 文件并初始化模块 example.com/user/hello go: creating new go.mod: module example.com/user/hello $ cat go.mod module example.com/user/hello @@ -83,14 +69,13 @@Your first program
-The first statement in a Go source file must be
-package name
. Executable commands must always use
-package main
.
+ Go 源文件中的第一条必须是
+ package name
。可执行方法必须位于
+ package main
下。
-Next, create a file named hello.go
inside that directory containing
-the following Go code:
+ 接下来,创建一个名为 hello.go
的文件,其中包含如下内容:
@@ -104,7 +89,7 @@Your first program
-Now you can build and install that program with the go
tool:
+ 现在你可以使用 go
tool 去构建和安装该程序:
@@ -113,25 +98,21 @@Your first program
-This command builds the hello
command, producing an executable
-binary. It then installs that binary as $HOME/go/bin/hello
(or,
-under Windows, %USERPROFILE%\go\bin\hello.exe
).
+ 通过此命令构建了 hello
命令。它生成可执行的二进制文件,
+ 并将该二进制文件安装为 $HOME/go/bin/hello
(在windows中为 %USERPROFILE%\go\bin\hello.exe
)。
-The install directory is controlled by the GOPATH
-and GOBIN
environment
-variables. If GOBIN
is set, binaries are installed to that
-directory. If GOPATH
is set, binaries are installed to
-the bin
subdirectory of the first directory in
-the GOPATH
list. Otherwise, binaries are installed to
-the bin
subdirectory of the default GOPATH
-($HOME/go
or %USERPROFILE%\go
).
+ Go的环境变量 GOPATH
和 GOBIN
可以控制安装目录。
+ 如果设置了 GOBIN
,那么二进制文件将会安装在设置的 GOBIN
目录下。
+ 如果设置了 GOPATH
,那么二进制文件将会安装在 GOPATG
根目录的 bin
文件夹下。
+ 如果均为设置,那么二进制文件会被安装在默认 GOPATH
根目录($HOME/go
或 %USERPROFILE\go
)的
+ bin
文件夹下。
+
-You can use the go env
command to portably set the default value
-for an environment variable for future go
commands:
+ 你可以使用 go env
命令修改 go
默认的环境变量:
@@ -140,7 +121,7 @@Your first program
-To unset a variable previously set by go env -w
, use go env -u
:
+ 可使用 go env -u
命令来还原由 go env -w
设置的变量:
@@ -148,17 +129,17 @@+Your first program
$
-Commands like go install
apply within the context of the module
-containing the current working directory. If the working directory is not within
-the example.com/user/hello
module, go install
may fail.
+ 如 go install
需要在对应模块及其子目录中应用。如果工作目录不在 example.com/user/hello
模块内,
+ 那么 go install
会失败。
+
-For convenience, go
commands accept paths relative
-to the working directory, and default to the package in the
-current working directory if no other path is given.
-So in our working directory, the following commands are all equivalent:
+ go
命令接受相对工作目录的路径,但如果未输入路径,则默认会使用当前目录的软件包作为输入。
+ 因此,在我们的工作目录中,下面的命令是等价的:
@@ -173,16 +154,14 @@+Your first program
$ go install
-Next, let's run the program to ensure it works. For added convenience, we'll
-add the install directory to our PATH
to make running binaries
-easy:
+ 接下来,让我们运行程序来确认它能正确运行。为了方便调用,我们将二进制的安装文件添加到 PATH
中:
-# Windows users should consult https://github.com/golang/go/wiki/SettingGOPATH -# for setting %PATH%. +# Windows 系统下设置 %PATH% 可参考 https://github.com/golang/go/wiki/SettingGOPATH $ export PATH=$PATH:$(dirname $(go list -f '{{"{{"}}.Target{{"}}"}}' .)) $ hello Hello, world. @@ -190,9 +169,7 @@Your first program
-If you're using a source control system, now would be a good time to initialize -a repository, add the files, and commit your first change. Again, this step is -optional: you do not need to use source control to write Go code. + 如果您使用了代码版本控制系统,那么现在就是初始化仓库、添加文件并提交更改的好时机。同样,这个步骤是可选的:您可以不使用代码版本控制系统编写 Go 代码。
@@ -207,28 +184,25 @@Your first program
-The go
command locates the repository containing a given module path by requesting a corresponding HTTPS URL and reading metadata embedded in the HTML response (see
-go help importpath
).
-Many hosting services already provide that metadata for repositories containing
-Go code, so the easiest way to make your module available for others to use is
-usually to make its module path match the URL for the repository.
+ go
命令通过请求相应的HTTPS URL并读取HTML响应中嵌入的元数据来查找包含给定模块路径的存储库。
+ (详情见 go help importpath
).
+ 许多托管服务已经为包含Go代码的存储库提供了该元数据,因此使您的模块可供其他人使用的最简单方法通常是使其模块路径与存储库的URL相匹配。
-Let's write a morestrings
package and use it from the hello
program.
-First, create a directory for the package named
-$HOME/hello/morestrings
, and then a file named
-reverse.go
in that directory with the following contents:
+
+ 让我们编写一个 morestrings
包,并在 hello
程序中使用它。
+ 首先,创建目录 $HOME/hello/morestrings
,
+ 然后在该目录中添加文件 reverse.go
,其中包含以下内容:
-// Package morestrings implements additional functions to manipulate UTF-8 -// encoded strings, beyond what is provided in the standard "strings" package. +// 包 morestrings 实现了一些标准库 "strings" 中没有的函数来操纵UTF-8编码的字符串。 package morestrings -// ReverseRunes returns its argument string reversed rune-wise left to right. +// ReverseRunes 返回翻转后的字符串 func ReverseRunes(s string) string { r := []rune(s) for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 { @@ -239,14 +213,13 @@Importing packages from your module
-Because our ReverseRunes
function begins with an upper-case
-letter, it is exported,
-and can be used in other packages that import our morestrings
-package.
+ 因为我们的ReverseRunes函数以大写字母开头,所以它是 exported,
+ 即可以在导入 morestrings
包的其他包中使用。
+
-Let's test that the package compiles with go build
:
+ 让我们测试一下该软件包是否可以通过 go build
编译:
@@ -256,14 +229,12 @@Importing packages from your module
-This won't produce an output file. Instead it saves the compiled package in the -local build cache. + 这不会产生输出文件,而是将已编译的程序包保存在本地构建缓存中。
-After confirming that the morestrings
package builds, let's use it
-from the hello
program. To do so, modify your original
-$HOME/hello/hello.go
to use the morestrings package:
+ 确认 morestrings
软件包已生成后,我们在 hello
程序中使用它。
+ 因此,我们需要修改原先的 $HOME/hello/hello.go
去使用 morestrings
包:
@@ -281,7 +252,7 @@Importing packages from your module
-Install the hello
program:
+ 安装 hello
程序:
@@ -289,7 +260,7 @@Importing packages from your module
-Running the new version of the program, you should see a new, reversed message: + 运行新版本的程序,您应该看到一条被翻转的字符串:
@@ -297,13 +268,11 @@-Importing packages from your module
Hello, Go!
-An import path can describe how to obtain the package source code using a
-revision control system such as Git or Mercurial. The go
tool uses
-this property to automatically fetch packages from remote repositories.
-For instance, to use github.com/google/go-cmp/cmp
in your program:
+ 导入路径可以描述如何使用版本控制系统(例如Git或Mercurial)获取软件包源代码。
+ go
工具使用此属性来自动从远程存储库中获取软件包。 例如,要在程序中使用 github.com/google/go-cmp/cmp
:
@@ -323,10 +292,8 @@Importing packages from remote modules
-Now that you have a dependency on an external module, you need to download that
-module and record its version in your go.mod
file. The go
-mod tidy
command adds missing module requirements for imported packages
-and removes requirements on modules that aren't used anymore.
+ 现在你依赖了一个外部模块,你需要下载该模块,同时在 go.mod
文件中记录它的版本号。
+ go mod tidy
命令会自动添加缺失的必须依赖,同时移除没有使用的依赖。
@@ -350,13 +317,10 @@Importing packages from remote modules
-Module dependencies are automatically downloaded to the pkg/mod
-subdirectory of the directory indicated by the GOPATH
environment
-variable. The downloaded contents for a given version of a module are shared
-among all other modules that require
that version, so
-the go
command marks those files and directories as read-only. To
-remove all downloaded modules, you can pass the -modcache
flag
-to go clean
:
+
+ 模块依赖将自动下载到 GOPATH
环境变量指示的目录的 pkg/mod
子目录中。
+ 给定版本的模块的下载内容在需要该版本的所有其他模块之间共享,因此 go
命令将这些文件和目录标记为只读。
+ 要移除所有下载的模块,可以在 go clean
命令中使用 -modcache
参数:
@@ -364,26 +328,22 @@-Importing packages from remote modules
$
-Go has a lightweight test framework composed of the go test
-command and the testing
package.
+ Go有一个轻量级的测试框架,由 go test
命令和 testing
包组成。
-You write a test by creating a file with a name ending in _test.go
-that contains functions named TestXXX
with signature
-func (t *testing.T)
.
-The test framework runs each such function;
-if the function calls a failure function such as t.Error
or
-t.Fail
, the test is considered to have failed.
+
+
+ 你可以通过创建一个以 _test.go
结尾的文件来编写测试,里面包含命名类似为 TestXXX
的函数,签名为 func (t *testing.T)
。
+ 测试框架通过运行每个函数,如果该函数运行过程中调用了如 t.Error
或 t.Fail
等失败函数,则认定为函数测试失败。
-Add a test to the morestrings
package by creating the file
-$HOME/hello/morestrings/reverse_test.go
containing
-the following Go code.
+
+ 通过在 morestrings
包中创建包含下列代码的 $HOME/hello/morestrings/reverse_test.go
文件来进行函数测试:
@@ -409,7 +369,7 @@Testing
-Then run the test with go test
:
+ 运行 go test
命令进行测试:
@@ -420,51 +380,48 @@Testing
-Run go help test
and see the
-testing package documentation for more detail.
+
+ 可以通过运行 go help test
和查阅 testing
+ 包文档获取命令更多细节。
-Subscribe to the
-golang-announce
-mailing list to be notified when a new stable version of Go is released.
+
+ 通过订阅 golang-announce 可以在 Go
发布新的稳定版时获取通知。
-See Effective Go for tips on writing -clear, idiomatic Go code. + + 可以通过学习 Effective Go 了解如何编写清晰、符合习惯的代码。
-Take {{if $.GoogleCN}} -A Tour of Go + 打开{{if $.GoogleCN}} + Go 学习之旅 {{else}} -A Tour of Go -{{end}} to learn the language -proper. + Go 学习之旅 +{{end}}系统学习 Go
-Visit the documentation page for a set of in-depth -articles about the Go language and its libraries and tools. + 通过 文档 深入了解关于 Go 语言及其库和工具。
--For real-time help, ask the helpful gophers in the community-run -gophers Slack server -(grab an invite here). + 通过在 gophers Slack server 中发帖获取实时的帮助。 + (邀请链接点击 这里)
-The official mailing list for discussion of the Go language is -Go Nuts. + 讨论Go语言的官方邮件列表是 + Go Nuts。
-Report bugs using the -Go issue tracker. + 通过 + Go issue tracker 提交bug。
diff --git a/_content/doc/docs.html b/_content/doc/docs.html index e876bb24cc..1329a4fc81 100644 --- a/_content/doc/docs.html +++ b/_content/doc/docs.html @@ -1,53 +1,46 @@-The Go programming language is an open source project to make programmers more -productive. +Go 编程语言是一个开源项目,它使程序员更具生产力。
-Go is expressive, concise, clean, and efficient. Its concurrency -mechanisms make it easy to write programs that get the most out of multicore -and networked machines, while its novel type system enables flexible and -modular program construction. Go compiles quickly to machine code yet has the -convenience of garbage collection and the power of run-time reflection. It's a -fast, statically typed, compiled language that feels like a dynamically typed, -interpreted language. +Go 语言具有很强的表达能力,它简洁、清晰而高效。得益于其并发机制,用它编写的程序能够非常有效地利用多核与联网的计算机,其新颖的类型系统则使程序结构变得灵活而模块化。 +Go 代码编译成机器码不仅非常迅速,还具有方便的垃圾收集机制和强大的运行时反射机制。 +它是一个快速的、静态类型的编译型语言,感觉却像动态类型的解释型语言。
--Instructions for downloading and installing Go. +下载和安装 Go 的说明。
--A brief Hello, World tutorial to get started. Learn a bit about Go code, tools, packages, and modules. +简明 Hello,World 入门指南。了解一些有关 Go 代码,工具,包和模块的信息。
--A tutorial of short topics introducing functions, error handling, arrays, maps, unit testing, and compiling. +简短的主题教程,介绍函数,错误处理,数组,map,单元测试和编译。
--Building a simple web application. +构建一个简单的 Web 应用程序。
-
-This doc explains how to develop a simple set of Go packages inside a module,
-and it shows how to use the go
command
-to build and test packages.
+该文档说明了如何在模块内开发一系列简单的 Go 包,并展示了如何使用 go
命令来构建和测试包。
-An interactive introduction to Go in three sections. -The first section covers basic syntax and data structures; the second discusses -methods and interfaces; and the third introduces Go's concurrency primitives. -Each section concludes with a few exercises so you can practice what you've -learned. You can {{if not $.GoogleCN}}take the tour -online or{{end}} install it locally with: +Go 语言的交互式简介,它分为三部分。 +第一部分介绍基本语法和数据结构;第二部分讨论方法和接口。 +第三部分介绍 Go 的并发原语。每节末尾都有几个练习,你可以对自己的所学进行实践。 +你可以 在线学习 或 安装到本地:
$ go get golang.org/x/tour
-This will place the tour
binary in your workspace's bin
directory.
+这会将 tour
二进制文件安装到工作区的 bin
目录中。
-A document that gives tips for writing clear, idiomatic Go code. -A must read for any new Go programmer. It augments the tour and -the language specification, both of which should be read first. +提供有关编写清晰、惯用的 Go 代码的文档。新手 Go 程序员一定得阅读。 +它是对指南和语言规范的补充,你应该先阅读指南和语言规范。
--A document that summarizes commonly used editor plugins and IDEs with -Go support. +该文档总结了 Go 支持的常用编辑器插件和 IDE。
--Summarizes tools and methodologies to diagnose problems in Go programs. +总结了诊断 Go 程序中问题的工具和方法。
--When your code uses external packages, those packages (distributed as modules) become dependencies. +当你的代码使用外部包时,那些包(作为模块分发的)将成为依赖项。
--You can collect related packages into modules, then publish the modules for other developers to use. This topic gives an overview of developing and publishing modules. +你可以将相关的包收集到模块中,然后分发供其他开发人员使用的模块。本主题概述了开发和发布模块。
--When you develop modules for use by other developers, you can follow a workflow that helps ensure a reliable, consistent experience for developers using the module. This topic describes the high-level steps in that workflow. +当你开发被其他开发人员使用的模块时,你应该遵循工作流程,为使用该模块的开发者提供可靠的,一致的体验。本主题描述了该工作流程中的高级步骤。
--When you're developing modules to publish for others to use, you can help ensure that your modules are easier for other developers to use by following the repository conventions described in this topic. +当你正在开发用于其他人使用的模块时,你可以通过遵循本主题中描述的存储库约定,以确保你的模块更容易被其他开发人员使用。
-A major version update can be very disruptive to your module's users because it includes breaking changes and represents a new module. Learn more in this topic. +主要版本更新对模块的用户来说具有破坏性,因为它包括不兼容更改并代表一个新模块。在本主题中了解更多信息。
--When you want to make a module available for other developers, you publish it so that it's visible to Go tools. Once you've published the module, developers importing its packages will be able to resolve a dependency on the module by running commands such as go get. +当你想要为其他开发人员提供一个可用的模块时,你会发布它,以便 Go 工具可以看到。一旦你发布了该模块,开发人员将通过运行命令(例如 go get)来解决模块上的依赖项。
--A module's developer uses each part of a module's version number to signal the version’s stability and backward compatibility. For each new release, a module's release version number specifically reflects the nature of the module's changes since the preceding release. +模块的开发人员使用模块版本号的每个部分来表示版本的稳定性和向后兼容性。对于每个新版本,模块的发版版本号明确地反映了自前一版本以来模块更改的性质。
--Answers to common questions about Go. + 回答有关 Go 的常见问题。
--The documentation for the Go standard library. +Go 标准库文档
--The documentation for the Go tools. +Go 工具文档
--The official Go Language specification. +官方 Go 语言规范
--A detailed reference manual for Go's dependency management system. +Go 依赖管理系统的详细参考手册。
--Reference for the directives included in a go.mod file. +go.mod 文件中的指令参考手册。
--A document that specifies the conditions under which reads of a variable in -one goroutine can be guaranteed to observe values produced by writes to the -same variable in a different goroutine. +此文档指定了在一个 goroutine 中,写入一个变量所产生的值,能够保证被另一个 goroutine 所读取的条件。
-A summary of the changes between Go releases.
+Go 版本之间的更改摘要。
--Guided tours of Go programs. +Go 程序的旅行指南。
The official blog of the Go project, featuring news and in-depth articles by -the Go team and guests.
+Go 项目的官方博客,其中包含 Go 团队和嘉宾的特色新闻和深入性的文章。
--The Go Wiki, maintained by the Go community, includes articles about the Go language, tools, and other resources. +Go 社区维护的 Go Wiki, 包括 Go 语言、工具和其他资源的相关文章。
-See the Learn page at the Wiki -for more Go learning resources. +有关更多 Go 学习资源,请参见 Wiki 上的 Learn 页面。
{{if not $.GoogleCN}} --Three things that make Go fast, fun, and productive: -interfaces, reflection, and concurrency. Builds a toy web crawler to -demonstrate these. +有三个特性使得 Go 快速、有趣而高效:接口、反射与并发。本视频将通过构建一个玩具网络爬虫来展示它们。
--One of Go's key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk Andrew Gerrand describes a simple "chat roulette" server that matches pairs of incoming TCP connections, and then use Go's concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. While the function of the program changes dramatically, Go's flexibility preserves the original design as it grows. +Go 的关键设计目标之一就是代码的适应性,它应当易于得到简单的设计,并以干净而自然的方式构建。 在此演讲中,Andrew Gerrand 描述了一种简单的“轮流聊天”服务,它匹配一对 TCP 接入的连接, 并使用 Go 的并发机制、接口和标准库来为它扩展出 Web 界面和其它特性。当该程序的函数戏剧性地改变后, Go 的灵活性在它增长时保留了其原始的设计。
--Concurrency is the key to designing high performance network services. Go's concurrency primitives (goroutines and channels) provide a simple and efficient means of expressing concurrent execution. In this talk we see how tricky concurrency problems can be solved gracefully with simple Go code. +并发是设计高性能网络服务的关键。Go 的并发原语(goroutines 与 channels)提供了一种表达并发执行的简单高效的方法。在本次演讲中,我们看到如何使用简单的Go代码优雅地解决棘手的并发问题。
--This talk expands on the Go Concurrency Patterns talk to dive deeper into Go's concurrency primitives. +本演讲在 Go 并发模式演讲的基础上进行了扩充,以更深入地探究 Go 的并发原语。
--See the Go Talks site and wiki page for more Go talks. +更多关于 Go 的演讲见 Go 演讲网站和维基页面。
{{end}} --See the NonEnglish page -at the Wiki for localized -documentation. +本地化文档见 Wiki 的非英语页面。本地化文档见 Wiki 的非英语页面。
diff --git a/_content/doc/install.html b/_content/doc/install.html index f66954232d..c480fda014 100644 --- a/_content/doc/install.html +++ b/_content/doc/install.html @@ -1,23 +1,21 @@- Download and install Go quickly with the steps described here. + 根据这里的描述快速的下载和安装 Go。
-For other content on installing, you might be interested in:
+您可能会感兴趣的其他有关安装的内容:
- Click the button below to download the Go installer. + 点击下方的按钮下载 Go 安装程序。
@@ -26,18 +24,15 @@ 1. Go download.
- Don't see your operating system here? Try one of the - other downloads. + 没有您使用的操作系统? 请尝试 + 其他下载内容.
-- Select the tab for your computer's operating system below, then follow its - installation instructions. + 在下方选择您使用的操作系统选项卡,然后按照说明进行安装操作。
- Important: This step will remove a previous - installation at /usr/local/go, if any, prior to extracting. - Please back up any data before proceeding. -
-
- For example, run the following as root or through sudo
:
+ 例如,以 root 身份或者 sudo
方式运行以下命令:
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz @@ -96,32 +85,26 @@2. Go install.
>
PATH
environment variable.
+ 将 /usr/local/go/bin 目录添加至 PATH
环境变量。
- You can do this by adding the following line to your $HOME/.profile or - /etc/profile (for a system-wide installation): + 您可以将下方的命令添加至 $HOME/.profile 或 /etc/profile (给所有系统用户) 来完成环境变量的添加:
export PATH=$PATH:/usr/local/go/bin -+
- Note: Changes made to a profile file may not apply
- until the next time you log into your computer. To apply the changes
- immediately, just run the shell commands directly or execute them from
- the profile using a command such as
- source $HOME/.profile
.
+ 请注意: 对配置文件的修改可能需要在下一次登录时生效。
+
如果需要立即使修改生效,只需要执行 source $HOME/.profile
之类的命令即可。
$ go version
- The package installs the Go distribution to /usr/local/go. The package
- should put the /usr/local/go/bin directory in your
- PATH
environment variable. You may need to restart any
- open Terminal sessions for the change to take effect.
+ 该软件包会将Go安装到 /usr/local/go 目录。 该安装包会将 /usr/local/go/bin 添加到您的 PATH
环境变量中。
+ 您可能需要重新启动您所有打开的终端程序来使其生效。
$ go version -+
- By default, the installer will install Go to Program Files
- or Program Files (x86)
. You can change the
- location as needed. After installing, you will need to close and
- reopen any open command prompts so that changes to the environment
- made by the installer are reflected at the command prompt.
+ 默认情况下,安装程序会将 Go 安装到 Program Files
+ 或 Program Files (x86)
。您可以根据需要更改位置。安装后,您需要关闭并重新打开任何打开的命令提示符,以便使安装程序对环境的修改在命令提示符程序中生效。
cmd
, then press the
- Enter key.
+ 在搜索框中输入 cmd
,然后按下
+ 回车 键。
$ go version -+
- You're set up! Visit the - Getting Started tutorial to write - some simple Go code. It takes about 10 minutes to complete. + 您已经正确设置好了!访问 + 入门教程 去编写一些简单的 Go 代码。 + 这大概需要十分钟的时间就可以完成。
diff --git a/_content/doc/root.html b/_content/doc/root.html index 92be7ec3f7..35004552fb 100644 --- a/_content/doc/root.html +++ b/_content/doc/root.html @@ -6,30 +6,28 @@
- Binary distributions available for
- Linux, macOS, Windows, and more.
+ 我们提供了 Linux, macOS, Windows 等系统下的二进制发行版